zoukankan      html  css  js  c++  java
  • 计算机科学系数据结构C#实现的代码(2.2)

    闲来无事,拿大学时候的数据结构书来看,发现书记结构的算法都没有实际的代码来实现,故用C#来把所有的算法实际代码写出来,可能跟书上的不一样,如效率不高,请指正。

    int[] LA = new int[] {1,4,6,8,9 };
                int[] LB = new int[] { 235610 };
                string s = "";
                int JCopy = 0;
                for (int i = 0; i < LA.Length; i++)
                {
                    for (int j = JCopy; j < LB.Length; j++)
                    {
                        if (LA[i] <= LB[j])
                        {
                           //记录b数组的现在的位置,break一下,在去读取a数组
                            JCopy = j;
                            s += LA[i].ToString();
                            break;
                        }
                        else
                        {
                            //a比b大继续循环b数组
                            s += LB[j].ToString();
                        }
                    }
                }
                Console.Write(s);
                Console.Read();
  • 相关阅读:
    Oracle 添加主键和索引
    Oracle中查询主键、外键、sequence、表基本信息等
    Spring工作原理
    Ehcache 缓存使用
    socket编程-java
    oracle触发器详解
    单例模式的几种写法
    [LeetCode] 412. Fizz Buzz 嘶嘶嗡嗡
    LeetCode Top Interview Questions
    [LeetCode] 131. Palindrome Partitioning 回文分割
  • 原文地址:https://www.cnblogs.com/theMaxBear/p/3674676.html
Copyright © 2011-2022 走看看