Ejemplo n.º 1
0
 public static void MainTest(string[] args)
 {
   TextInput StdIn = new TextInput();
   string[] a = StdIn.ReadAllStrings();
   InsertionX.Sort(a);
   OrderHelper.Show(a);
 }
Ejemplo n.º 2
0
        public static void MainTest(string[] args)
        {
            int[]           a   = { 33, 22, 11, 31, 35, 27, 24, 25 };
            StaticSETofInts set = new StaticSETofInts(a);

            Console.WriteLine("Set contains:");
            OrderHelper.Show(a);
            Console.WriteLine("Set contains {0}: {1}", 11, set.Contains(11));
            Console.WriteLine("Rank of {0}: {1} with same rank: {2}", 35, set.Rank(35), (a.Length - 1) == set.Rank(35));
        }
Ejemplo n.º 3
0
        public static void MainTest(string[] args)
        {
            TextInput StdIn = new TextInput();

            string[] a = StdIn.ReadAllStrings();
            OrderHelper.Show(a);

            // shuffle
            StdRandom.Shuffle(a);

            // display results again using select
            Console.WriteLine();
            for (int i = 0; i < a.Length; i++)
            {
                string ith = (string)Quick.Select(a, i);
                Console.WriteLine(ith);
            }
        }