+ 1
Use the binary heap to return the k elements from largest to smallest
I did code below. I started to build the maxHeap first and then removeMax. After that i stored it into an array from root, which is the largest element to smallest then I returned the k elements largest. However, it said the error from line "Word result = wordArray[0];" in removeMax() method. Could someone help me to fix it? https://code.sololearn.com/cqU80EohWkt0/#java
2 Antworten
0
Tuyen Pham Check your link, its not a valod code link
0
i fixed this @KrOW