MCPcopy Create free account
hub / github.com/careercup/ctci / printMinHeapAndMaxHeap

Method printMinHeapAndMaxHeap

java/Chapter 18/Question18_9/Question.java:55–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53 }
54
55 public static void printMinHeapAndMaxHeap(){
56 Integer[] minHeapArray = minHeap.toArray(
57 new Integer[minHeap.size()]);
58 Integer[] maxHeapArray = maxHeap.toArray(
59 new Integer[maxHeap.size()]);
60
61 Arrays.sort(minHeapArray, maxHeapComparator);
62 Arrays.sort(maxHeapArray, maxHeapComparator);
63 System.out.print("MinHeap =");
64 for (int i = minHeapArray.length - 1; i >= 0 ; i--){
65 System.out.print(" " + minHeapArray[i]);
66 }
67 System.out.print("\nMaxHeap =");
68 for (int i = 0; i < maxHeapArray.length; i++){
69 System.out.print(" " + maxHeapArray[i]);
70 }
71 }
72
73 public static void main(String[] args) {
74 int arraySize = 10;

Callers 1

Calls 3

sizeMethod · 0.45
sortMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected