Exemple #1
0
 public void AddSorted(int data)
 {
     if (headNode == null)
     {
         headNode = new nodeClass(data);
     }
     else if (data < headNode.data)
     {
         AddToBegginning(data);
     }
     else
     {
         headNode.AddSorted(data);
     }
 }
Exemple #2
0
 public void AddSorted(int data)
 {
     if (Next == null)
     {
         Next = new nodeClass(data);
     }
     else if (data < Next.data)
     {
         nodeClass temp = new nodeClass(data);
         temp.Next = this.Next;
         this.Next = temp;
     }
     else
     {
         Next.AddSorted(data);
     }
 }