Exemplo n.º 1
0
        static void Zadatak2()
        {
            double[]       numbers    = { 44.23, 33.2, 22.22, 11.56357, 55, 66.8, 77, 88, 99.9999 };
            NumberSequence sequence   = new NumberSequence(numbers);
            BubbleSort     bubbleSort = new BubbleSort();
            BinarySearch   search     = new BinarySearch();

            sequence.SetSearchStrategy(search, 22.22);
            sequence.SetSortStrategy(bubbleSort);
            sequence.Sort();
            sequence.Search();
        }
Exemplo n.º 2
0
        static void Zadatak1()
        {
            double[]       numbers   = { 44.23, 33.2, 22.2, 11.56357, 55, 66.8, 77, 88, 99.9999 };
            NumberSequence sequence1 = new NumberSequence(numbers);
            SequentialSort sort1     = new SequentialSort();

            sequence1.SetSortStrategy(sort1);
            sequence1.Sort();
            Console.WriteLine("sequentialsort" + sequence1.ToString());

            NumberSequence sequence2 = new NumberSequence(numbers);
            BubbleSort     sort2     = new BubbleSort();

            sequence2.SetSortStrategy(sort2);
            sequence2.Sort();
            Console.WriteLine("bubblesort" + sequence2.ToString());

            NumberSequence sequence3 = new NumberSequence(numbers);
            CombSort       sort3     = new CombSort();

            sequence3.SetSortStrategy(sort3);
            sequence3.Sort();
            Console.WriteLine("combsort" + sequence3.ToString());
        }