public static void Test() { Heap <int> heap = new Heap <int>(); heap.SetHeapType(false); heap.Insert(4); heap.Insert(6); heap.Insert(8); heap.Insert(5); heap.Insert(9); heap.Insert(3); heap.Insert(1); heap.Insert(0); heap.Insert(20); heap.Insert(10); heap.Insert(16); HeapHelper <int> .Log(heap._list); TestHeapCreate(); }
public static void TestHeapCreate() { Heap <int> heap = new Heap <int>(); heap.SetHeapType(false); Random random = new Random(); heap._list = new List <int>() { 4, 6, 8, 5, 9, 3, 1, 0, 20, 10, 16 }; for (int i = 0; i < 30; ++i) { int value = random.Next(10, 500); heap._list.Add(value); } heap.HeapCreate(); Console.WriteLine(); HeapHelper <int> .Log(heap._list); }