Example #1
0
        public void CreateCycle()
        {
            //We are setting creating a loop - Circular Linked List
            LinkListStackNode cur = Current;

            while (cur.Next != null)
            {
                cur = cur.Next;
            }

            cur.Next         = Current;
            Current.Previous = cur;
        }
Example #2
0
        public void Push(string item)
        {
            var newItem = new LinkListStackNode(item);

            if (Current == null)
            {
                //The head
                Current = newItem;
            }
            else if (Current.Next == null)
            {
                Current.Next     = newItem;
                newItem.Previous = Current;
                Tail             = newItem;
            }
            else
            {
                newItem.Previous = Tail;
                Tail.Next        = newItem;
            }

            //_list.Add(newItem);
            Tail = newItem;
        }