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();
        }

    }
原文地址:https://www.cnblogs.com/gmq/p/513182.html