Пример #1
0
 private IEnumerable <SortedWords> SelectWords(DownloadWords dw)
 {
     while (true)
     {
         yield return(new SortedWords(dw)
         {
         });
     }
 }
Пример #2
0
        private void ExectuteProgram()
        {
            int amountOfSearchesToPerform = 100;
            var downloadWords             = new DownloadWords();
            var randomWords = new Program().SelectWords(downloadWords).Take(amountOfSearchesToPerform);
            var search      = new Searches();

            foreach (var word in randomWords)
            {
                search.LinearSearch(word);
                search.BinarySearch(word);
            }

            var combinedLinearSearchTime = TotalSearchTimes("linear", search);
            var combinedBinarySearchTime = TotalSearchTimes("binary", search);

            PrintResults(combinedLinearSearchTime, combinedBinarySearchTime, amountOfSearchesToPerform);
            Console.ReadLine();
        }
Пример #3
0
 private void SplitDownloadedWordsIntoArray(DownloadWords dw)
 {
     WordsSeperatedIntoArray = dw.WordsFromSource.Split('\n');
     RandomWord = GenerateRandomWord();
 }
Пример #4
0
 public SortedWords(DownloadWords dw)
 {
     SplitDownloadedWordsIntoArray(dw);
 }