Example #1
0
        public static void Run()
        {
            SimpleBST bst = new SimpleBST();

            bst.Put(2, 2);
            bst.Put(4, 4);
            bst.Put(3, 3);
            bst.Put(1, 1);

            //bst.Delete(2);

            Queue q = bst.Traverse();

            /*foreach (SimpleBSTNode a in q)
             * {
             *  Console.WriteLine(a.key);
             * }*/

            Console.WriteLine(bst.Ceil(-2).key);



            /*Console.WriteLine("min:{0}", bst.min().key);
             * Console.WriteLine("min:{0}", bst.min(bst.root.right).key);
             * Console.WriteLine("max:{0}", bst.max());
             *
             * q = bst.RangeSelect(2, 4);
             * foreach (SimpleBSTNode a in q)
             * {
             *  Console.WriteLine(a.key);
             * }*/
        }
        public static void Run()
        {
            SimpleBST bst = new SimpleBST();
            bst.Put(2,2);
            bst.Put(4, 4);
            bst.Put(3, 3);
            bst.Put(1, 1);

            //bst.Delete(2);

            Queue q = bst.Traverse();
            /*foreach (SimpleBSTNode a in q)
            {
                Console.WriteLine(a.key);
            }*/

            Console.WriteLine(bst.Ceil(-2).key);

            /*Console.WriteLine("min:{0}", bst.min().key);
            Console.WriteLine("min:{0}", bst.min(bst.root.right).key);
            Console.WriteLine("max:{0}", bst.max());

            q = bst.RangeSelect(2, 4);
            foreach (SimpleBSTNode a in q)
            {
                Console.WriteLine(a.key);
            }*/
        }