Exemple #1
0
 public void InList(int inf)
 {
     Node p = new Node(inf, head);
     if (ListIsEmpty())
     {
         head = p;
         tail = p;
     }
     else
     {
         tail.next = p;
         tail = p;
         tail.next = head;
     }
     count++;
 }
Exemple #2
0
        public void Delete(int index)
        {
            if (index != 0)
            {
                Node p = head;
                for (int i = 0; i < index - 1; i++)
                    p = p.next;
                if (p.next != null)
                    p.next = p.next.next;
            }

            else
            {
                head = head.next;
                tail.next = head;
            }
            count--;
        }
Exemple #3
0
 public Node(int inf, Node next)
 {
     this.inf = inf;
     this.next = next;
 }
Exemple #4
0
 public MyList()
 {
     head = null;
     tail = null;
     count = 0;
 }