If you ignore the cost associated with the min heap itself, sure - you just insert each item (n) and take items out until you have them all (n). However, these are not constant time operations for the min heap, so that has to be taken into ...
http://www.blurtit.com/q1750118.html
Heap-sort means using the heap structure and heap operations, as defined in my previous post, to sort a container such as an array. The complexity for heap sort is O(n * log2n), explained next. Take each element from the unsorted array and ...
http://www.blogcatalog.com/blogs/world-of-brock/posts/t...
Yes the array that is sorted in increasing order is a min-heap . Choose any node at position i, for any 2<=i <= n. Its parent is at position trunc(i/2). i > trunc(i/2). Since the array is sorted, A[i] >=A[trunc(i/2)]. Hence for ...
http://socrates.troy.edu/%7Emmariano/GAlgWeb/CIS546_ans...
For in-place sorting, the fastest way follows. Beware of off-by-one errors in my code. Note that this method gives a reversed sorted list which needs to be unreversed in the final step. If you use a max-heap, this problem goes away. The gen...
http://stackoverflow.com/questions/113991/what-is-the-f...
in a heap sort firstly we construct a binary tree. then we make it a max or min heap tree. in a max heap tree, each parent node is bigger than its 2 child node. after constructing a heap tree, we remove the root node and then modify the tre...
http://answers.yahoo.com/question/index?qid=20100211025...
In computer science and mathematics, a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important to optimizing the u...
http://answers.yahoo.com/question/index?qid=20100126202...
I assume you are using some sort of struct or object to represent nodes, which carry pointers to child nodes. Place nodes in the heap using a postorder traversal (left subtree, right subtree, root). Postorder traversal will prevent you from...
http://answers.yahoo.com/question/index?qid=20090330221...