示例#1
0
 public void AddSorted(int input)
 {
     if (HeadNode == null)
     {
         HeadNode = new Node(input);
     }
     else if (input < HeadNode.data)
     {
         Prepend(input);
     }
     else
     {
         HeadNode.AddSorted(input);
     }
 }
示例#2
0
 public void AddSorted(int data)
 {
     if (headNode == null)
     {
         headNode = new Node(data);
     }
     else if (data < headNode.data)
     {
         AddToBeginning(data);
     }
     else
     {
         headNode.AddSorted(data);
     }
 }
示例#3
0
 public void AddSorted(int input)
 {
     if (next == null)
     {
         next = new Node(input);
     }
     else if (input < next.data)
     {
         Node temp = new Node(input);
         temp.next = this.next;
         this.next = temp;
     }
     else
     {
         next.AddSorted(input);
     }
 }
 public void AddSorted(int data)
 {
     if (next == null)
     {
         next = new Node(data);
     }
     else if (next.data > data)
     {
         Node temp = new Node(data);
         temp.next = next;
         next      = temp;
     }
     else
     {
         next.AddSorted(data);
     }
 }