Un/Down heap

Hello! At test tutor gave us strange task.
2. Let T be an array of floating point numbers, all unique. Using binary heap find k smallest values from T.
-void unheap (double*T, int N, int i){
-void downheap (double*T, int N, int i){
-double*KSmallest (List*L){

He never mentioned what upheap and downheap is. I tried to find something about it on my own but without any succes. Can some one tell me how to 'bite' this problem? I and the rest of my class will be very grateful.
Last edited on
If you copy and pasted that, you misread - it says "unheap" with an N, not "upheap" with a P.
Oh yeah. Right. Thanks! But this does not change anything. Considering the names of functions (which make some sense now) i have to reorder entire heap and then by function downheap sort this heap from lowest to highest and in the last function return K first elements which should be the smallest now? Is this a good way?
closed account (3TXyhbRD)
You could look at it as a heap and not as an "array". It depends on your heap relation (min heap or max heap?).
Topic archived. No new replies allowed.