• 0

[c] Urgent: Reheapdown


Question

this a question from a book i dont know the answer to and i have a test tomorrow on this chapter. so i want to understand it for sure :(

its a short answer, so it wont take much time

q) assume you are working with a random array of integers with a range from 100 to 1000. in the algorithm reheapDown what is the largest value that u can use for the variable lowkey? why?

if u want to see the code of reheapDown here it is

http://www.mdofit.com/labs/15c/project/heapheader.c

thanks :) :cry:

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

sorry, the line of code where u see

rightKey = -1; // the -1 in pseudocode is the lowkey

my answer is 99 but i am not sure

i dont have a good explanation as to why should i support 99

but its kinda like when u do the comparison

of leftkey > rightkey

if rightkey doesnt exist and we should set it to a number that is out of range and at the same time assured to be less than leftKey

so the max to suit that condition would be 99

am i wrong or right?

thanks

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.