Urgent: reheapDown

This is a discussion on Urgent: reheapDown within the C Programming forums, part of the General Programming Boards category; this a question from a book i dont know the answer to and i have a test tomorrow on this ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    71

    Urgent: reheapDown

    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

  2. #2
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    urgent? urgent for who? my frog?
    hello, internet!

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    I don't even see a variable called lowkey...

  4. #4
    Registered User
    Join Date
    May 2002
    Posts
    71
    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
    Last edited by mackol; 11-24-2002 at 10:05 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Urgent Help Needed In Writing Algorithm!!
    By Vikramnb in forum C++ Programming
    Replies: 1
    Last Post: 01-09-2009, 12:46 PM
  2. Minimax, URGENT :(
    By Dark-MX0Z in forum C++ Programming
    Replies: 6
    Last Post: 11-14-2007, 06:29 AM
  3. help... urgent,... thanks!
    By weihann in forum C Programming
    Replies: 6
    Last Post: 02-28-2002, 10:17 PM
  4. Urgent!!!
    By Mitchell in forum Windows Programming
    Replies: 5
    Last Post: 10-11-2001, 04:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21