Esempio n. 1
0
 /// <summary>
 /// Creating of a list
 /// </summary>
 public List()
 {
     head = new ListElement();
     head.data = 0;
     head.next = null;
     length = 0;
 }
Esempio n. 2
0
 /// <summary>
 /// ADding value to the list
 /// </summary>
 /// <param name="value">value</param>
 /// <param name="pos">position</param>
 public void AddToList(int value, ListElement pos)
 {
     ListElement tmp = new ListElement();
     tmp.data = value;
     tmp.next = pos.next;
     pos.next = tmp;
     length++;
 }
Esempio n. 3
0
 /// <summary>
 /// Deleting from list
 /// </summary>
 /// <param name="pos">position</param>
 public void DeleteFromList(ListElement pos)
 {
     ListElement tmp = this.head;
     if (this.head.next == null)
         return;
     while (tmp.next == null || tmp.next != pos)
     {
         tmp = tmp.next;
     }
     tmp.next = pos.next;
     length--;
 }
Esempio n. 4
0
 public ListElement Next(ListElement pos)
 {
     return pos.next;
 }
Esempio n. 5
0
 /// <summary>
 /// Returns 
 /// </summary>
 /// <param name="pos"></param>
 /// <returns></returns>
 public int Retrieve(ListElement pos)
 {
     return pos.data;
 }