public void Run()
        {
            const int capacityPerSubstack = 5;
            var       set = new SetOfStacks(capacityPerSubstack);

            Console.WriteLine("IsEmpty? {0}", set.IsEmpty());

            for (var i = 0; i < 34; i++)
            {
                set.Push(i);
            }
            Console.WriteLine("IsEmpty? {0}", set.IsEmpty());

            for (var i = 0; i < 34; i++)
            {
                if (i == 0)
                {
                    set.PopAt(i);
                }
                else
                {
                    Console.WriteLine("Popped " + set.Pop());
                }
            }
        }
Beispiel #2
0
        public void Run()
        {
            const int capacityPerSubstack = 5;
            var set = new SetOfStacks(capacityPerSubstack);

            Console.WriteLine("IsEmpty? {0}", set.IsEmpty());

            for (var i = 0; i < 34; i++)
            {
                set.Push(i);
            }
            Console.WriteLine("IsEmpty? {0}", set.IsEmpty());

            for (var i = 0; i < 34; i++)
            {
                if (i == 0)
                {
                    set.PopAt(i);
                }
                else
                {
                    Console.WriteLine("Popped " + set.Pop());
                }
            }
        }