Solved

Trivial Build Max Heap Question

Posted on 2004-10-04
3
319 Views
Last Modified: 2010-03-31
Hello,

I was trying to remember the max heap, and I came up with this pseudocode.  However, I forget why the loop index i (2nd line) decreases from floor of length[A]/2 to 1 rather than increase from 1 to floor of length[A]/2.

-----------------------------------------------------
pseudocode:
-----------------------------------------------------
BuildMaxHeap(A)
1    heapSize[A] <-- length[A]
2    for i <-- length[A]/2 down to 1
3        do MaxHeapify(A,i)
-----------------------------------------------------

Thank you!

-luna621 =^^=
0
Comment
Question by:luna621
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 100 total points
Comment Utility
0
 

Author Comment

by:luna621
Comment Utility
Once again zzynx, you have out done yourself.  That website was very helpful.  I'll study it to refresh my heaps :D
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
:°) Thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Exchange and Third Party application. 8 59
noX challenge 17 75
JAVA part two 5 39
Java - Why doesn't this JFrame work 3 14
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now