Codelogn
Tuesday, May 13, 2014
Heap Sort in Big O
Keys
1. add(x) and remove(x) are O(log n).
2. The height of the heap is
.
3. The number of nodes at height
is
4. The cost of heapifying all subtrees is: (Sum of step-3 against each height)
* uses the fact that the give
n infinite
series
h
/ 2
h
converges
to 2.
Reference
http://opendatastructures.org/versions/edition-0.1e/ods-java/10_1_BinaryHeap_Implicit_Bi.html
http://en.wikipedia.org/wiki/Binary_heap#Heap_implementation
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment