示例#1
0
        internal static void Search(List <string> toFind, LinkedList <dList> lwList)
        {
            string fileName = null;

            Console.WriteLine("Podaj nazwe pliku do jakiego chcesz zapisac dane wykresu: ");
            fileName = Console.ReadLine();
            TextWriter doWykresu = new StreamWriter(Directory.GetCurrentDirectory() + "/" + fileName + ".csv", true);
            Stopwatch  sw        = new Stopwatch();

            for (int k = 1; k < toFind.Count + 1; k++)
            {
                sw.Start();
                for (int i = 0; i < k; i++)
                {
                    dList found = lwList.SingleOrDefault(r => r.English == toFind[i]);

                    Console.WriteLine($"{i + 1}:Znaleziono {found.English} oraz {found.Polish}");
                }
                sw.Stop();
                var newLine = string.Format("{0};{1}",
                                            k.ToString(), sw.Elapsed.TotalMilliseconds);
                sw.Reset();
                doWykresu.WriteLine(newLine.ToString());
                Console.WriteLine();
            }
            doWykresu.Close();
        }
示例#2
0
            public Node Insert(Node root, dList v)
            {
                if (root == null)
                {
                    root       = new Node();
                    root.value = v;
                }
                else if (v.English.CompareTo(root.value.English) < 0)
                {
                    root.left = Insert(root.left, v);
                }
                else
                {
                    root.right = Insert(root.right, v);
                }

                return(root);
            }