Example #1
0
 /// <summary>
 /// Ctor that takes an initial state as a Lst T
 /// </summary>
 internal StckInternal(Lst <T> initial)
 {
     tail = new StckInternal <T>();
     foreach (var item in initial)
     {
         value = item;
         tail  = tail.Push(item);
         Count++;
     }
     tail = tail.Pop();
 }
Example #2
0
 /// <summary>
 /// Ctor that takes an initial state as an IEnumerable T
 /// </summary>
 public StckInternal(IEnumerable <T> initial)
 {
     tail = new StckInternal <T>();
     foreach (var item in initial)
     {
         value = item;
         tail  = tail.Push(item);
         Count++;
     }
     tail = tail.Pop();
 }
Example #3
0
        public QueInternal <T> Dequeue()
        {
            var f = forward.Pop();

            if (!f.IsEmpty)
            {
                return(new QueInternal <T>(f, backward));
            }
            else if (backward.IsEmpty)
            {
                return(Empty);
            }
            else
            {
                return(new QueInternal <T>(BackwardRev, StckInternal <T> .Empty));
            }
        }