Example #1
0
 public void AddToEnd(int data)
 {
     if (Next == null)
     {
         Next = new nodeClass(data);
     }
     else
     {
         Next.AddToEnd(data);
     }
 }
Example #2
0
 public void AddToEnd(int data)
 {
     if (headNode == null)
     {
         headNode = new nodeClass(data);
     }
     else
     {
         headNode.AddToEnd(data);
     }
 }
Example #3
0
 public void AddToBegginning(int data)
 {
     if (headNode == null)
     {
         headNode = new nodeClass(data);
     }
     else
     {
         nodeClass temp = new nodeClass(data);
         temp.Next = headNode;
         headNode  = temp;
     }
 }
Example #4
0
 public void AddSorted(int data)
 {
     if (headNode == null)
     {
         headNode = new nodeClass(data);
     }
     else if (data < headNode.data)
     {
         AddToBegginning(data);
     }
     else
     {
         headNode.AddSorted(data);
     }
 }
Example #5
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);
     }
 }
Example #6
0
 public myList()
 {
     headNode = null;
 }
Example #7
0
 public nodeClass(int i)
 {
     data     = i;
     Next     = null;
     Previous = null;
 }