Exemple #1
0
 static void ex3()
 {
     int[]    arr = { 8, 4, 5, 3, 1, 2 };
     Object[] a   = arr.Select(b => (object)b).ToArray();
     Console.WriteLine(Convert.ToInt32(Heapify.FindKthMaxValue(a, 4)));
     int[]    arr1 = { 5, 3, 8, 4, 1, 2 };
     Object[] a1   = arr1.Select(b => (object)b).ToArray();
     Console.WriteLine(Convert.ToInt32(Heapify.FindKthMaxValueOldSchool(a1, 4)));
 }
Exemple #2
0
        static void ex2()
        {
            int[]    arr        = { 5, 3, 8, 4, 1, 2 };
            Object[] a          = arr.Select(b => (object)b).ToArray();
            var      arrHeapped = Heapify.heapify(a);

            foreach (var item in arrHeapped)
            {
                Console.WriteLine(Convert.ToInt32(item));
            }
            //Convert.ToInt32((Object[])arrHeapped);
        }