| | |
Build-Heap number of comparisons
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
![]() |
•
•
Join Date: Apr 2006
Posts: 2
Reputation:
Solved Threads: 0
I need to prove that for binary heaps, BuildHeap does at most 2N-2
comparisons between elements.
I tried many approaches but i'm stuck.
I know that Build-Heap calls Heapify N/2 times.
each Heapify call you get 2 comparisons. the element with it's two sons.
then you have a recursive call to haepify.
can anyone help me with that?
comparisons between elements.
I tried many approaches but i'm stuck.
I know that Build-Heap calls Heapify N/2 times.
each Heapify call you get 2 comparisons. the element with it's two sons.
then you have a recursive call to haepify.
can anyone help me with that?
Prove it for the cases where N is one less than a power of two.
Then, as you add new elements across the new bottom row, find a pattern into how much each individual element contributes to the total possible number of comparisons.
Then, as you add new elements across the new bottom row, find a pattern into how much each individual element contributes to the total possible number of comparisons.
All my posts may be redistributed under the GNU Free Documentation License.
![]() |
Similar Threads
- huffman code (C++)
- Heap block at 003D2CA0 modified at 003D2CB3 past requested size of b (C++)
- Heap of 8 with 8 comparisons (Computer Science)
- Algorithm Efficiency Help!!!! (C)
- Program alone doesn't help. (C++)
- Search program help in modifications (Java)
Other Threads in the Computer Science Forum
- Previous Thread: Heap of 8 with 8 comparisons
- Next Thread: help plase
| Thread Tools | Search this Thread |
ai algorithm algorithms amazon assignment assignmenthelp automata battery binary bittorrent bizarre bletchleypark blogging bomb business cern codebreaker compiler computer computers computerscience computertrackingsoftware connect conversion csc dataanalysis dataintepretation development dfa dissertation dissertations dissertationthesis dissertationtopic ebook employment energy extensions floatingpoint foreclosure foreclosuresoftware fuel gadgets geeks givemetehcodez government graphics hardware history homeowners homeworkassignment humor ibm idea ideas internet iphone ipod itcontracts jobs kindle laser laws linkbait lsmeans marketing mining mobileapplication msaccess nano netbeans networking news os piracy piratebay principles programming rasterizer research sam-being-cute sas science security sex spying sql stephenfry study supercomputer supercomputing sweden technology textfield turing turingtest two'scompliment uk virus warehouse ww2






