I am trying to solve this leetcode challenge . I implemented a MaxHeap and tried to popout the values to get the Kth largest element in the array but I get a time limit exceeded. Is there any issue with my MaxHeap implementation that it is slow or can this be done in a faster method? Problem https://leetcode.com/problems/kth-largest-element-in-an-array/ } Answer
Tag: heapsort
Heapsort Within a Given Range
I am trying to write a Heapsort method that only performs the sort within a given range passed into the method. The ranges low and high are passed in and these values correspond to values inside the heap, not indices of the heap. For example, the input array might be: 28 10 49 20 59 61 17 and if low
What’s wrong with my In Place Heap Sorting code
I’m working on a school assignment and the assignment was to make a heap sorting (In Place) program. Now the program works perfectly fine for arrays with under +- 20 elements, above that it occasionally messes up, however I can’t seem to find what’s wrong. The skeleton for the methods was already there so if you’re asking why certain parameters