示例#1
0
        public void Inserttest()
        {
            var t = new Treap();

            Assert.IsTrue(t.Insert(10));
            Assert.IsTrue(t.Insert(8));
            Assert.IsTrue(t.Insert(3));
            Assert.IsFalse(t.Insert(3));
        }
示例#2
0
        public void TestExercise7ab()
        {
            var t = new Treap();

            t.Insert(8, 2);
            t.Insert(9, 3);
            t.Insert(2, 1);
            t.Insert(5, 7);
            t.Insert(3, 8);
            t.Insert(1, 4);
            t.Insert(4, 5);
            t.Insert(6, 6);


            // Insert (7,0)
            Console.WriteLine("Before Insert of (7,0)");
            t.Print();
            Console.WriteLine();

            t.Insert(7, 0);

            Console.WriteLine("After Insert of (7,0)");
            t.Print();
            Console.WriteLine();


            // Delete (8,2)
            Console.WriteLine("Delete of (8,2)");
            t.Delete(8);
            t.Print();
            Console.WriteLine();
        }
示例#3
0
    void Solve()
    {
        /*var hoge = new List<int>();
         * for (var i = 0; i < 20; i++) hoge.Add(Treap<int>.rand.Next(100));
         * var tr = new Treap<int>();
         * foreach (var x in hoge) tr.Insert(x);
         * WriteLine("hoge = " + string.Join(", ", hoge));
         * WriteLine("tr   = " + string.Join(", ", tr));
         * hoge.Sort();
         * WriteLine("hoge = " + string.Join(", ", hoge));
         * WriteLine(tr);
         * var a = hoge[Treap<int>.rand.Next(20)];
         * tr.Remove(a);
         * WriteLine($"removed {a}");
         * WriteLine(tr);*/
        var Q  = F;
        var tr = new Treap <int>();

        while (Q-- > 0)
        {
            var I = G;
            if (I[0] == 1)
            {
                tr.Insert(I[1]);
            }
            else
            {
                var x = tr.At(I[1] - 1);
                WriteLine(x.Value);
                tr.Remove(x.Value);
            }
        }
    }
示例#4
0
    public static void Main()
    {
        int         n     = int.Parse(Console.ReadLine());
        Treap <int> treap = new Treap <int>();

        for (int i = 0; i < n; i++)
        {
            var query = Console.ReadLine().Split();
            if (query[0] == "print")
            {
                Console.WriteLine(treap);
                continue;
            }
            var key = int.Parse(query[1]);
            if (query[0] == "find")
            {
                Console.WriteLine(treap.Contains(key) ? "yes" : "no");
                continue;
            }
            if (query[0] == "delete")
            {
                treap.Remove(key);
                continue;
            }
            if (query[0] == "insert")
            {
                treap.Insert(key, int.Parse(query[2]));
            }
        }
    }
示例#5
0
        public void MoveTest()
        {
            Treap <int> treap = new Treap <int>();

            treap.Insert(0, 1);
            treap.Insert(1, 2);
            treap.Insert(2, 3);
            treap.Insert(3, 4);
            treap.Insert(4, 5);

            treap.Move(1, 3);

            Assert.AreEqual(treap[1], 3);
            Assert.AreEqual(treap[2], 4);
            Assert.AreEqual(treap[3], 2);
        }
示例#6
0
        public void TestExercise7c()
        {
            var t = new Treap();

            t.Insert(7, 0);
            t.Insert(9, 3);
            t.Insert(2, 1);
            t.Insert(5, 7);
            t.Insert(3, 8);
            t.Insert(1, 4);
            t.Insert(4, 5);
            t.Insert(6, 6);

            t.Print();
        }
示例#7
0
        public void printtest()
        {
            var t = new Treap();

            t.Insert(10);
            t.Insert(1);
            t.Insert(15);
            t.Insert(7);
            t.Insert(8);
            t.Insert(4);
            t.Print();
        }
示例#8
0
        public void Deletetest()
        {
            var t = new Treap();

            t.Insert(10);
            t.Insert(1);
            t.Insert(15);
            t.Insert(7);
            t.Insert(8);
            t.Insert(4);
            Assert.IsTrue(t.Delete(10));
        }
示例#9
0
    public static void MainModule(TextReader In)
    {
        var lin = In.ReadLine().Split(' ').Select(n => int.Parse(n)).ToArray();

        A = lin[0];
        B = lin[1];
        Q = lin[2];

        var ss = new Treap <long>();
        var ts = new Treap <long>();
        var xs = new long[Q];

        for (int i = 0; i < A; i++)
        {
            ss.Insert(long.Parse(In.ReadLine()));
        }
        for (int i = 0; i < B; i++)
        {
            ts.Insert(long.Parse(In.ReadLine()));
        }
        for (int i = 0; i < Q; i++)
        {
            xs[i] = long.Parse(In.ReadLine());
        }

        const long SmallValue = -100000000000L;
        const long BigValue   = 100000000000L;

        foreach (var x in xs)
        {
            var si   = ss.FindIndex(x);
            var s0   = si <= 0 ? SmallValue : ss[si - 1];
            var s1   = si >= A ? BigValue : ss[si];
            var ti   = ts.FindIndex(x);
            var t0   = ti <= 0 ? SmallValue : ts[ti - 1];
            var t1   = ti >= B ? BigValue : ts[ti];
            var s0t0 = Math.Max(x - s0, x - t0);
            var s0t1 = (x - s0) + (t1 - x) + Math.Min((x - s0), (t1 - x));
            var s1t0 = (s1 - x) + (x - t0) + Math.Min((s1 - x), (x - t0));
            var s1t1 = Math.Max(s1 - x, t1 - x);
            var can  = new long[] { s0t0, s0t1, s1t0, s1t1, };
            Console.WriteLine(can.Min());
        }
    }
示例#10
0
        public void Rotationtest()
        {
            var t = new Treap();

            t.Insert(10);
            t.Insert(1);
            t.Insert(15);
            t.Insert(7);
            t.Insert(8);
            t.Insert(4);
            //before Rotation
            t.Print();

            //after Rotation
            t.RotationHeap(4);
            t.Print();
        }
示例#11
0
        public void Deletetestrotatetest()
        {
            var t = new Treap();

            t.Insert(10);
            t.Insert(1);
            t.Insert(15);
            t.Insert(7);
            t.Insert(8);
            t.Insert(4);

            //before Delete
            t.Print();
            t.Delete(4);

            //after delete
            t.Print();
        }
示例#12
0
        public void Deletepriotesttreevomscript()
        {
            var t = new Treap();

            t.Insert(7, 6);
            t.Insert(5, 9);
            t.Insert(11, 10);
            t.Insert(3, 11);
            t.Insert(6, 13);
            t.Insert(1, 18);
            t.Insert(9, 12);
            t.Insert(14, 14);
            t.Insert(8, 15);
            t.Insert(12, 15);
            t.Insert(15, 17);

            //before Delete
            Console.WriteLine("Before Delete (7)");
            t.Print();
            t.Delete(7);

            Console.WriteLine("After Delete (7)");
            //after delete
            t.Print();
        }
示例#13
0
        public void insertpriotesttreevomscript()
        {
            var t = new Treap();

            t.Insert(7, 6);
            t.Insert(5, 9);
            t.Insert(11, 10);
            t.Insert(3, 11);
            t.Insert(6, 13);
            t.Insert(1, 18);
            t.Insert(9, 12);
            t.Insert(14, 14);
            t.Insert(8, 15);
            t.Insert(12, 15);
            t.Insert(15, 17);
            //befor insert
            Console.WriteLine("Before Insert (13,7)");
            t.Print();

            //after
            Console.WriteLine("After Insert (13,7)");
            t.Insert(13, 7);
            t.Print();
        }
示例#14
0
        static void Start(string[] args)
        {
            Console.OutputEncoding = Encoding.Unicode;
            ConsoleKeyInfo input;
            ConsoleKeyInfo input2;
            ConsoleKeyInfo CaseInput;
            ConsoleKeyInfo input3;


            while (true) // Outer Loop - Dictionary
            {
                Console.Clear();
                Banner.PrintBanner();
                Banner.PrintDicSuggestions();
                input = Console.ReadKey();
                if (input.Key == ConsoleKey.D1)
                {
                    do // Array decision which dictionary
                    {
                        Console.Clear();
                        Banner.Printbanner1();
                        Banner.PrintTypeSuggestion();
                        IDictionary    array;
                        ConsoleKeyInfo type = Console.ReadKey();
                        if (type.Key == ConsoleKey.D1)
                        {
                            array = new MultiSetSortedArray();
                        }
                        else if (type.Key == ConsoleKey.D2)
                        {
                            array = new MultiSetUnsortedArray();
                        }
                        else if (type.Key == ConsoleKey.D3)
                        {
                            array = new SetSortedArray();
                        }
                        else if (type.Key == ConsoleKey.D4)
                        {
                            array = new SetUnsortedArray();
                        }
                        else if ((type.Key == ConsoleKey.Backspace) || (type.Key == ConsoleKey.Escape))
                        {
                            break;
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("input not accepted try again");
                            Console.ReadKey();
                            continue;
                        }
                        do // Inner Loop Array
                        {
                            Console.Clear();
                            Banner.Printbanner1();
                            Banner.PrintOperationSuggestions();
                            input2 = Console.ReadKey();
                            if (input2.Key == ConsoleKey.S)
                            {
                                Banner.PrintSearchSuggestions();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }

                                bool success = array.Search(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("found your integer!");
                                }
                                else
                                {
                                    Console.WriteLine("Did not find your integer");
                                }
                            }
                            else if (input2.Key == ConsoleKey.I)
                            {
                                Banner.PrintInsertSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                bool success = array.Insert(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("successfully inserted " + inputint);
                                }
                                else
                                {
                                    Console.WriteLine("could not insert" + inputint);
                                }
                            }
                            else if (input2.Key == ConsoleKey.D)
                            {
                                Banner.PrintDeleteSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                try
                                {
                                    bool success = array.Delete(inputint);
                                    if (success == true)
                                    {
                                        Console.WriteLine("successfully deleted " + inputint);
                                    }
                                    else
                                    {
                                        Console.WriteLine("could not delete" + inputint);
                                    }
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Array Empty");
                                }
                            }
                            else if (input2.Key == ConsoleKey.P)
                            {
                                Banner.PrintPrintMessage();
                                Console.WriteLine();
                                array.Print();
                            }
                            Console.WriteLine("press any key to continue");
                            Console.ReadKey();
                        } while (input2.Key != ConsoleKey.Backspace);
                    }while (input.Key != ConsoleKey.Backspace);
                }
                if (input.Key == ConsoleKey.D2)
                {
                    do // Lists decision which dictionary
                    {
                        Console.Clear();
                        Banner.Printbanner2();
                        Banner.PrintTypeSuggestion();
                        IDictionary    list;
                        ConsoleKeyInfo type = Console.ReadKey();
                        if (type.Key == ConsoleKey.D1)
                        {
                            list = new MultiSetSortedLinkedList();
                        }
                        else if (type.Key == ConsoleKey.D2)
                        {
                            list = new MultiSetUnsortedLinkedList();
                        }
                        else if (type.Key == ConsoleKey.D3)
                        {
                            list = new SetSortedLinkedList();
                        }
                        else if (type.Key == ConsoleKey.D4)
                        {
                            list = new SetUnsortedLinkedList();
                        }
                        else if ((type.Key == ConsoleKey.Backspace) || (type.Key == ConsoleKey.Escape))
                        {
                            break;
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("input not accepted try again");
                            Console.ReadKey();
                            continue;
                        }
                        do // Inner Loop Array
                        {
                            Console.Clear();
                            Banner.Printbanner2();
                            Banner.PrintOperationSuggestions();
                            input2 = Console.ReadKey();
                            if (input2.Key == ConsoleKey.S)
                            {
                                Banner.PrintSearchSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                bool success = list.Search(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("found your integer!");
                                }
                                else
                                {
                                    Console.WriteLine("Did not find your integer");
                                }
                            }
                            else if (input2.Key == ConsoleKey.I)
                            {
                                Banner.PrintInsertSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                bool success = list.Insert(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("successfully inserted " + inputint);
                                }
                                else
                                {
                                    Console.WriteLine("could not insert" + inputint);
                                }
                            }
                            else if (input2.Key == ConsoleKey.D)
                            {
                                Banner.PrintDeleteSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                bool success = list.Delete(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("successfully deleted " + inputint);
                                }
                                else
                                {
                                    Console.WriteLine("could not delete" + inputint);
                                }
                            }
                            else if (input2.Key == ConsoleKey.P)
                            {
                                Console.WriteLine();
                                Banner.PrintPrintMessage();
                                Console.WriteLine();
                                list.Print();
                            }
                            Console.WriteLine("press any key to continue");
                            Console.ReadKey();
                        } while (input2.Key != ConsoleKey.Backspace);
                    }while (input.Key != ConsoleKey.Backspace);
                }
                if (input.Key == ConsoleKey.D3)
                {
                    do // BinaryTree decision which dictionary
                    {
                        IDictionary bintree = new BinSearchTree();

                        do // Inner Loop BinaryTree
                        {
                            Console.Clear();
                            Banner.Printbanner3();
                            Banner.PrintOperationSuggestions();
                            input2 = Console.ReadKey();
                            if (input2.Key == ConsoleKey.S)
                            {
                                Banner.PrintSearchSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                bool success = bintree.Search(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("found your integer!");
                                }
                                else
                                {
                                    Console.WriteLine("Did not find your integer");
                                }
                            }
                            else if (input2.Key == ConsoleKey.I)
                            {
                                Banner.PrintInsertSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                bool success = bintree.Insert(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("successfully inserted " + inputint);
                                }
                                else
                                {
                                    Console.WriteLine("could not insert" + inputint);
                                }
                            }
                            else if (input2.Key == ConsoleKey.D)
                            {
                                Banner.PrintDeleteSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                bool success = bintree.Delete(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("successfully deleted " + inputint);
                                }
                                else
                                {
                                    Console.WriteLine("could not delete" + inputint);
                                }
                            }
                            else if (input2.Key == ConsoleKey.P)
                            {
                                Console.WriteLine();
                                Banner.PrintPrintMessage();
                                Console.WriteLine();
                                bintree.Print();
                            }
                            Console.WriteLine("press any key to continue");
                            Console.ReadKey();
                        } while (input2.Key != ConsoleKey.Backspace);
                        Console.WriteLine("if you want to go back, press Backspace");
                        input = Console.ReadKey();
                    }while (input.Key != ConsoleKey.Backspace);
                }
                if (input.Key == ConsoleKey.D4)
                {
                    IDictionary avltree = new AVLTree();

                    do // Inner Loop AVL
                    {
                        Console.Clear();
                        Banner.Printbanner4();
                        Banner.PrintOperationSuggestions();
                        input2 = Console.ReadKey();
                        if (input2.Key == ConsoleKey.S)
                        {
                            Banner.PrintSearchSuggestions();
                            Console.WriteLine();
                            int inputint;
                            try
                            {
                                inputint = Convert.ToInt32(Console.ReadLine());
                            }
                            catch (Exception)
                            {
                                Console.WriteLine("Input is not an Integer, press any key and repeat");
                                Console.ReadKey();
                                continue;
                            }
                            bool success = avltree.Search(inputint);
                            if (success == true)
                            {
                                Console.WriteLine("found your integer!");
                            }
                            else
                            {
                                Console.WriteLine("Did not find your integer");
                            }
                        }
                        else if (input2.Key == ConsoleKey.I)
                        {
                            Banner.PrintInsertSuggestions();
                            Console.WriteLine();
                            int inputint;
                            try
                            {
                                inputint = Convert.ToInt32(Console.ReadLine());
                            }
                            catch (Exception)
                            {
                                Console.WriteLine("Input is not an Integer, press any key and repeat");
                                Console.ReadKey();
                                continue;
                            }
                            bool success = avltree.Insert(inputint);
                            if (success == true)
                            {
                                Console.WriteLine("successfully inserted " + inputint);
                            }
                            else
                            {
                                Console.WriteLine("could not insert" + inputint);
                            }
                        }
                        else if (input2.Key == ConsoleKey.D)
                        {
                            Banner.PrintDeleteSuggestions();
                            Console.WriteLine();
                            int inputint;
                            try
                            {
                                inputint = Convert.ToInt32(Console.ReadLine());
                            }
                            catch (Exception)
                            {
                                Console.WriteLine("Input is not an Integer, press any key and repeat");
                                Console.ReadKey();
                                continue;
                            }
                            bool success = avltree.Delete(inputint);
                            if (success == true)
                            {
                                Console.WriteLine("successfully deleted " + inputint);
                            }
                            else
                            {
                                Console.WriteLine("could not delete" + inputint);
                            }
                        }
                        else if (input2.Key == ConsoleKey.P)
                        {
                            Console.WriteLine();
                            Banner.PrintPrintMessage();
                            Console.WriteLine();
                            avltree.Print();
                        }
                        Console.WriteLine("press any key to continue");
                        Console.ReadKey();
                    } while (input2.Key != ConsoleKey.Backspace);
                }
                if (input.Key == ConsoleKey.D5)
                {
                    Treap treap = new Treap();
                    do // Inner Loop Treap
                    {
                        Console.Clear();
                        Banner.Printbanner5();
                        Banner.PrintOperationSuggestions();
                        input2 = Console.ReadKey();
                        if (input2.Key == ConsoleKey.S)
                        {
                            Banner.PrintSearchSuggestions();
                            Console.WriteLine();
                            int inputint;
                            try
                            {
                                inputint = Convert.ToInt32(Console.ReadLine());
                            }
                            catch (Exception)
                            {
                                Console.WriteLine("Input is not an Integer, press any key and repeat");
                                Console.ReadKey();
                                continue;
                            }
                            bool success = treap.Search(inputint);
                            if (success == true)
                            {
                                Console.WriteLine("found your integer!");
                            }
                            else
                            {
                                Console.WriteLine("Did not find your integer");
                            }
                        }
                        else if (input2.Key == ConsoleKey.I)
                        {
                            while (true) //1 rng , 2 own
                            {
                                Console.WriteLine();
                                Console.WriteLine("Press 1 for random Priorities or 2 for own Priorities");
                                CaseInput = Console.ReadKey();
                                if (CaseInput.Key != ConsoleKey.D1 && CaseInput.Key != ConsoleKey.D2)
                                {
                                    Console.WriteLine("you did not press 1 or 2, press any key and try again");
                                    Console.ReadKey();
                                    continue;
                                }
                                else
                                {
                                    break;
                                }
                            }
                            while (true)
                            {
                                Console.Clear();
                                Banner.Printbanner5();
                                Banner.PrintInsertSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }

                                bool success = false;
                                if (CaseInput.Key == ConsoleKey.D1)
                                {
                                    success = treap.Insert(inputint);
                                }
                                else
                                {
                                    int inputprio;
                                    while (true)
                                    {
                                        Console.WriteLine("enter your priority as Integer: ");
                                        try
                                        {
                                            inputprio = Convert.ToInt32(Console.ReadLine());
                                        }
                                        catch (Exception)
                                        {
                                            Console.WriteLine("Input is not an Integer, press any key and repeat");
                                            Console.ReadKey();
                                            continue;
                                        }
                                        break;
                                    }
                                    success = treap.Insert(inputint, inputprio);
                                }

                                if (success == true)
                                {
                                    Console.WriteLine("successfully inserted " + inputint);
                                }
                                else
                                {
                                    Console.WriteLine("could not insert" + inputint);
                                }
                                Console.WriteLine("press Backspace to escape loop");
                                input3 = Console.ReadKey();
                                if (input3.Key == ConsoleKey.Backspace)
                                {
                                    break;
                                }
                            }
                        }
                        else if (input2.Key == ConsoleKey.D)
                        {
                            Banner.PrintDeleteSuggestions();
                            Console.WriteLine();
                            int inputint;
                            try
                            {
                                inputint = Convert.ToInt32(Console.ReadLine());
                            }
                            catch (Exception)
                            {
                                Console.WriteLine("Input is not an Integer, press any key and repeat");
                                Console.ReadKey();
                                continue;
                            }
                            bool success = treap.Delete(inputint);
                            if (success == true)
                            {
                                Console.WriteLine("successfully deleted " + inputint);
                            }
                            else
                            {
                                Console.WriteLine("could not delete" + inputint);
                            }
                        }
                        else if (input2.Key == ConsoleKey.P)
                        {
                            Console.WriteLine();
                            Banner.PrintPrintMessage();
                            Console.WriteLine();
                            treap.Print();
                        }
                        Console.WriteLine("press any key to continue");
                        Console.ReadKey();
                    } while (input2.Key != ConsoleKey.Backspace);
                }
                if (input.Key == ConsoleKey.D6)
                {
                    do // Inner Loop Hash
                    {
                        Console.Clear();
                        Banner.Printbanner6();
                        Banner.PrintHashType();
                        IDictionary    hashstuff;
                        ConsoleKeyInfo type = Console.ReadKey();
                        if (type.Key == ConsoleKey.D1)
                        {
                            hashstuff = new HashTabQuadProb();
                        }
                        else if (type.Key == ConsoleKey.D2)
                        {
                            hashstuff = new HashTabSepChain();
                        }
                        else if (type.Key == ConsoleKey.Backspace)
                        {
                            break;
                        }
                        else
                        {
                            Console.WriteLine("Input not accepted");
                            Console.WriteLine("Press any key to try again");
                            Console.ReadKey();
                            continue;
                        }
                        do
                        {
                            Console.Clear();
                            Banner.Printbanner6();
                            Banner.PrintOperationSuggestions();
                            input2 = Console.ReadKey();
                            if (input2.Key == ConsoleKey.S)
                            {
                                Banner.PrintSearchSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                bool success = hashstuff.Search(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("found your integer!");
                                }
                                else
                                {
                                    Console.WriteLine("Did not find your integer");
                                }
                            }
                            else if (input2.Key == ConsoleKey.I)
                            {
                                Banner.PrintInsertSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                bool success = hashstuff.Insert(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("successfully inserted " + inputint);
                                }
                                else
                                {
                                    Console.WriteLine("could not insert" + inputint);
                                }
                            }
                            else if (input2.Key == ConsoleKey.D)
                            {
                                Banner.PrintDeleteSuggestions();
                                Console.WriteLine();
                                int inputint;
                                try
                                {
                                    inputint = Convert.ToInt32(Console.ReadLine());
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Input is not an Integer, press any key and repeat");
                                    Console.ReadKey();
                                    continue;
                                }
                                bool success = hashstuff.Delete(inputint);
                                if (success == true)
                                {
                                    Console.WriteLine("successfully deleted " + inputint);
                                }
                                else
                                {
                                    Console.WriteLine("could not delete" + inputint);
                                }
                            }
                            else if (input2.Key == ConsoleKey.P)
                            {
                                Console.WriteLine();
                                Banner.PrintPrintMessage();
                                Console.WriteLine();
                                hashstuff.Print();
                            }
                            Console.WriteLine();
                            Console.ReadKey();
                        } while (input2.Key != ConsoleKey.Backspace);
                        ////
                    } while (input.Key != ConsoleKey.Backspace);
                }


                //input = Console.ReadKey();
            }
        }