Esempio n. 1
0
        public void RemoveAt(int index)
        {
            Node aux = this.head;

            if (index == 0)
            {
                this.head = this.head.Next;

                if (head == null)
                {
                    this.last = null;
                }

                this.count--;
                return;
            }

            for (int i = 0; i < index - 1; i++)
            {
                aux = aux.Next;
            }

            aux.Next = aux.Next.Next;

            this.count--;
        }
Esempio n. 2
0
        public void Add(object o)
        {
            if (this.head == null)
            {
                this.head = new Node(o);
                this.last = this.head;
            }
            else
            {
                this.last.Next = new Node(o);
                this.last = this.last.Next;
            }

            this.count++;
        }
Esempio n. 3
0
 public LinkedList()
 {
     this.head = null;
     this.last = null;
     this.count = 0;
 }