Example #1
0
        public Stck <T> Reverse()
        {
            var s = new Stck <T>();

            foreach (var item in this)
            {
                s = s.Push(item);
            }
            return(s);
        }
Example #2
0
 internal Stck(Lst <T> initial)
 {
     tail = new Stck <T>();
     foreach (var item in initial)
     {
         value = item;
         tail  = tail.Push(item);
         Count++;
     }
     tail = tail.Pop();
 }
Example #3
0
 public Que <T> Enqueue(T value) =>
 IsEmpty
         ? new Que <T>(Stck <T> .Empty.Push(value), Stck <T> .Empty)
         : new Que <T>(forward, backward.Push(value));
Example #4
0
 /// <summary>
 /// Push an item onto the stack
 /// </summary>
 /// <param name="value">Item to push</param>
 /// <returns>New stack with the pushed item on top</returns>
 public static Stck <T> push <T>(Stck <T> stack, T value) =>
 stack.Push(value);