heapsort? priority que? heap?

Hello. I am kind of confused. I was trying to grip the idea of a heapsort. Does it have much to do with priority ques? Can you implement a heapsort with strings ? Help would be fantabulously appreciated max.
[214 byte] By [dets00ba] at [2007-11-27 4:43:46]
# 1

> Hello. I am kind of confused. I was trying to grip the idea of a heapsort.

http://en.wikipedia.org/wiki/Heapsort

> Does it have much to do with priority ques?

Not much, really. Probably nothing to do with.

> Can you implement a heapsort with strings?

Sure. As long as you have objects that can be compared, you can sort them.

> Help would be fantabulously appreciated max.

DrClapa at 2007-7-12 9:55:34 > top of Java-index,Java Essentials,New To Java...
# 2
[url #" style="display: block; background-image: url(' http://upload.wikimedia.org/wikipedia/en/1/1b/Sorting_heapsort_anim.gif'); width: 280px; height: 214px] [/url] http://en.wikipedia.org/wiki/Heap_sort
Hippolytea at 2007-7-12 9:55:34 > top of Java-index,Java Essentials,New To Java...
# 3
i gave away a star, i have 29 left! thanks for helping
dets00ba at 2007-7-12 9:55:34 > top of Java-index,Java Essentials,New To Java...
# 4

Heap and priority queue are synonyms, they mean the same thing. Heapsort basically works by adding data to a heap/priority queue and then pulling it out. The heap structure ensures that the data comes out in the order you have specified.

So yes, I would say that priority queues have something to do with heap sort.

jsalonena at 2007-7-12 9:55:35 > top of Java-index,Java Essentials,New To Java...
# 5
Now thats a guy i respect. Clear, polite, and to the point, thank you very much for clearing that up for me. If i knew how to give stars i'd give them all to you, im not sure what they do tho lol.
dets00ba at 2007-7-12 9:55:35 > top of Java-index,Java Essentials,New To Java...
# 6
> Heap and priority queue are synonyms, they mean the same thing.hmm actually they are not the same thing... a heap is one (fairly efficient) way of implementing a priority queue. But it's possible to implement a priority queue without using a heap.
jsalonena at 2007-7-12 9:55:35 > top of Java-index,Java Essentials,New To Java...
# 7
how would one implement a priority que as a heap?
dets00ba at 2007-7-12 9:55:35 > top of Java-index,Java Essentials,New To Java...
# 8
> how would one implement a priority que as a heap?public class Heap implements PriorityQueue{...}
Hippolytea at 2007-7-12 9:55:35 > top of Java-index,Java Essentials,New To Java...
# 9

adding (enqueuing) an element to a priority queue corresponds to inserting it in a heap

removing (dequeuing) an element from a priority queue corresponds to removing the root node of a heap

the algorithms for inserting and removing can be found in any algorithm text book .. likely there's a link to them in wikipedia

http://en.wikipedia.org/wiki/Heap_(data_structure)

jsalonena at 2007-7-12 9:55:35 > top of Java-index,Java Essentials,New To Java...