Beispiel #1
0
        public void Megre(IntList lista)
        {
            if (head == null)
            {
                head = lista.GetFirst();
                return;
            }
            if (lista == null)
            {
                return;
            }

            IntNode thisTail = head.Prev;
            IntNode thisHead = head;
            IntNode newTail  = lista.GetLast();
            IntNode newHead  = lista.GetFirst();

            thisTail.Next = newHead;
            newHead.Prev  = thisTail;
            newTail.Next  = thisHead;
            thisHead.Prev = newTail;
        }
Beispiel #2
0
        // Nije gotova
        public void Reverse()
        {
            if (head == null)
            {
                return;
            }

            IntList lista = new IntList();
            IntNode curr  = head.Prev;

            while (curr != head)
            {
                lista.AddLast(curr.Data);
                System.Console.WriteLine(curr.Data);
                curr = curr.Prev;
            }

            Clear();
            head = lista.GetFirst();
        }