示例#1
0
        public void WczytajSlowa(SlownikPolskiAVL a, SlownikPolskiAVL p) //dodać ANGIELSKI!!!!
        {
            string s = sr.ReadToEnd();

            string[] substrings = s.Split(new char[] { ' ', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < substrings.Count(); i++)
            {
                //parzyste - angielskie
                if (i % 2 == 0)
                {
                    //    a.WstawSlowo(new WezelAngielski(substrings[i]));
                }
                //polskie
                else
                {
                    //   p.WstawSlowo(new WezelPolski(substrings[i]));
                }
            }
            sr.Close();
        }
示例#2
0
        static void Main(string[] args)
        {
            WezelPolski root = null;

            SlownikPolskiAVL bst = new SlownikPolskiAVL();

            bst.WstawSlowo(ref root, "Anna");
            bst.WstawSlowo(ref root, "Balbina");
            bst.WstawSlowo(ref root, "Czeslaw");
            bst.WstawSlowo(ref root, "Darek");
            bst.WstawSlowo(ref root, "Eugeniusz");
            bst.WstawSlowo(ref root, "Filip");
            bst.WstawSlowo(ref root, "Kasia");
            bst.WstawSlowo(ref root, "Jan");
            bst.WstawSlowo(ref root, "Ludmila");
            bst.WstawSlowo(ref root, "Adam");


            /*int SIZE = 2000000;
             * int[] a = new int[SIZE];
             *
             * Console.WriteLine("Generating random array with {0} values...", SIZE);
             *
             * Random random = new Random();
             *
             * Stopwatch watch = Stopwatch.StartNew();
             *
             * for (int i = 0; i < SIZE; i++)
             * {
             *  a[i] = random.Next(10000);
             * }
             *
             * watch.Stop();
             *
             * Console.WriteLine("Done. Took {0} seconds", (double)watch.ElapsedMilliseconds / 1000.0);
             * Console.WriteLine();
             * Console.WriteLine("Filling the tree with {0} nodes...", SIZE);
             *
             * watch = Stopwatch.StartNew();
             *
             * for (int i = 0; i < SIZE; i++)
             * {
             *  root = bst.insert(root, a[i]);
             * }
             *
             * watch.Stop();
             *
             * Console.WriteLine("Done. Took {0} seconds", (double)watch.ElapsedMilliseconds / 1000.0);
             * Console.WriteLine();
             * Console.WriteLine("Traversing all {0} nodes in tree...", SIZE);
             *
             * watch = Stopwatch.StartNew();
             *
             * bst.traverse(root);
             *
             * watch.Stop();
             *
             * Console.WriteLine("Done. Took {0} seconds", (double)watch.ElapsedMilliseconds / 1000.0);
             * Console.WriteLine();
             *
             * Console.ReadKey();
             */
        }