Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var easyStack = new EasyStack <int>();

            easyStack.Push(1);
            easyStack.Push(2);
            easyStack.Push(3);
            easyStack.Push(4);

            var item  = easyStack.Pop();
            var item2 = easyStack.Peek();

            Console.WriteLine(item);
            Console.WriteLine(item2);



            var stack = new Stack <int>();

            stack.Push(1);
            stack.Push(2);
            stack.Push(2);
            stack.Push(3);
            stack.Push(31);
            stack.Push(32);

            var item3 = stack.Pop();
            var item4 = stack.Peek();

            Console.WriteLine(item3);
            Console.WriteLine(item4);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var easyStack = new EasyStack <int>();

            easyStack.Push(1);
            easyStack.Push(2);
            easyStack.Push(3);
            easyStack.Push(4);
            easyStack.Push(1);
            easyStack.Push(2);

            foreach (var item in easyStack)
            {
                Console.Write(item + " ");
            }

            Console.WriteLine();

            Console.WriteLine(easyStack.Pop());
            Console.WriteLine(easyStack.Peek());

            foreach (var item in easyStack)
            {
                Console.Write(item + " ");
            }

            Console.WriteLine();


            Console.ReadLine();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var easyStack = new EasyStack <int>();

            easyStack.Push(1);
            easyStack.Push(2);
            easyStack.Push(3);

            var item1 = easyStack.Pop();
            var item2 = easyStack.Peek();

            Console.WriteLine(item1);
            Console.WriteLine(item2);

            Console.ReadLine();

            Stack <double> stack = new Stack <double>();

            var linkedStack = new LinkedStack <int>();

            linkedStack.Push(10);
            linkedStack.Push(20);
            linkedStack.Push(30);
            //linkedStack.Push(20);
            //linkedStack.Push(30);
            //linkedStack.Push(40);
            //linkedStack.Push(50);

            Console.WriteLine(linkedStack.Peek());
            Console.WriteLine(linkedStack.Pop());
            Console.WriteLine(linkedStack.Pop());
            Console.WriteLine(linkedStack.Peek());

            Console.ReadLine();

            var arrayStack = new ArrayStack <int>(5);

            arrayStack.Push(100);
            arrayStack.Push(200);
            arrayStack.Push(300);
            arrayStack.Push(400);
            arrayStack.Push(500);
            //arrayStack.Push(600);

            Console.WriteLine(arrayStack.Count);
            Console.WriteLine(arrayStack.Peek());
            Console.WriteLine(arrayStack.Count);
            Console.WriteLine(arrayStack.MaxCount);
            Console.WriteLine(arrayStack.Pop());
            Console.WriteLine(arrayStack.MaxCount);
            Console.WriteLine(arrayStack.Count);
            Console.WriteLine(arrayStack.Pop());
            Console.WriteLine(arrayStack.MaxCount);
            Console.WriteLine(arrayStack.Count);
            Console.WriteLine(arrayStack.Peek());

            Console.ReadLine();
        }
Esempio n. 4
0
 static PathDataProvider()
 {
     pathData    = new PathData[MaxPathCache];
     freeEntries = new EasyStack <int>(MaxPathCache);
     for (var i = 0; i < MaxPathCache; i++)
     {
         pathData[i] = new PathData(i);
         freeEntries.Add(i);
     }
 }
Esempio n. 5
0
        static void Main(string[] args)
        {
            var easyStack = new EasyStack <int>();

            easyStack.Push(1);
            easyStack.Push(2);
            easyStack.Push(3);
            easyStack.Push(4);
            easyStack.Push(5);
            Console.WriteLine("кількість елементів до операцій = " + easyStack.Count);
            var item  = easyStack.Pop();
            var item2 = easyStack.Pop();
            var item3 = easyStack.Peek();

            Console.WriteLine("кількість елементів після операцій = " + easyStack.Count);

            Console.WriteLine(item);
            Console.WriteLine(item2);
            Console.WriteLine(item3);
            Console.ReadLine();

            Stack <double> stack = new Stack <double>();

            var linkedStack = new LinkedStack <int>();

            linkedStack.Push(10);
            linkedStack.Push(20);
            linkedStack.Push(30);


            Console.WriteLine(linkedStack.Peek());
            Console.WriteLine(linkedStack.Pop());
            Console.WriteLine(linkedStack.Pop());
            Console.WriteLine(linkedStack.Peek());
            Console.ReadLine();


            var arrayStack = new ArrayStack <int>(5);

            Console.WriteLine(arrayStack.Count);
            arrayStack.Push(100);
            Console.WriteLine(arrayStack.Count);
            arrayStack.Push(200);
            arrayStack.Push(300);
            arrayStack.Push(400);
            arrayStack.Push(500);

            Console.WriteLine(arrayStack.Peek());
            Console.WriteLine(arrayStack.Pop());
            Console.WriteLine(arrayStack.Pop());
            Console.WriteLine(arrayStack.Peek());

            Console.ReadLine();
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            var easyStack = new EasyStack <int>();

            easyStack.Push(1);
            easyStack.Push(4);
            easyStack.Push(2);
            easyStack.Push(6);

            var item = easyStack.Pop();

            var item2 = easyStack.Peek();

            Console.WriteLine(item);
            Console.WriteLine(item2);

            Console.WriteLine();

            Stack <double> stack = new Stack <double>();

            var linkedStack = new LinkedStack <int>();

            var arrayStack = new ArrayStack <int>(5);

            arrayStack.Push(101);
            arrayStack.Push(10);
            arrayStack.Push(33);
            arrayStack.Push(20);
            arrayStack.Push(15);

            Console.WriteLine(arrayStack.Peek());
            Console.WriteLine(arrayStack.Pop());
            Console.WriteLine(arrayStack.Peek());

            Console.WriteLine(arrayStack.ToString());


            Console.ReadLine();
        }