zoukankan      html  css  js  c++  java
  • Union Two Lists

    class Data_structure
        
    {
            
    public static void Main()
            
    {
                
    int []la={3,5,8,11};
                
    int []lb={2,6,8,9,11,15,20};
                
    int []lc=new int[11];
                
    int i=0,j=0,k=0;
            
    while(i<la.Length && j<lb.Length)
                
    {
                    
    if(la[i]<=lb[j])
                    
    {
                        lc[k
    ++]=la[i++];
                    }

                    
    else
                    
    {
                        lc[k
    ++]=lb[j++];
                    }
                    
                }

                
    while(i<la.Length)
                
    {
                    lc[k
    ++]=la[i++];
                }

                
    while(j<lb.Length)
                
    {
                    lc[k
    ++]=lb[j++];
                }
      
                
    foreach(int element in lc)
                    Console.Write(element
    +"\t");
                Console.Read();
            }

        }
  • 相关阅读:
    并发运行的思维模型
    进程和线程的区别
    拿来主义
    同步组件合作和团队合作 让世界变得更美好
    strace a++;b++;a+b;
    System 88: GDB Overview
    numpy多维数组维度及添加轴的理解
    Numpy入门
    python列表list 和numpy.array区别
    数组的生成方法
  • 原文地址:https://www.cnblogs.com/gmq/p/513182.html
Copyright © 2011-2022 走看看