public Stck <T> Reverse() { var s = new Stck <T>(); foreach (var item in this) { s = s.Push(item); } return(s); }
internal Stck(Lst <T> initial) { tail = new Stck <T>(); foreach (var item in initial) { value = item; tail = tail.Push(item); Count++; } tail = tail.Pop(); }
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));
/// <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);