Exemplo n.º 1
0
 /// <summary>
 /// Creating of a list
 /// </summary>
 public List()
 {
     head = new ListElement();
     head.data = 0;
     head.next = null;
     length = 0;
 }
Exemplo 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++;
 }
Exemplo 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--;
 }
Exemplo n.º 4
0
 public ListElement Next(ListElement pos)
 {
     return pos.next;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Returns 
 /// </summary>
 /// <param name="pos"></param>
 /// <returns></returns>
 public int Retrieve(ListElement pos)
 {
     return pos.data;
 }