Data structures and algorithms: Priority queue as Binary Tree

AI Thread Summary
Two efficient implementations of a priority queue using binary trees are the binary heap and the binary search tree. In a binary heap, elements are organized to maintain the heap property, allowing for efficient insertion and deletion of the highest priority element. Conversely, a binary search tree allows for ordered traversal, which can also facilitate priority queue operations but may not be as efficient for this purpose. When inserting the elements 15, 38, 45, 21, 8, 55, and 20, the two largest elements, 55 and 45, would be deleted from the priority queue. Understanding the concept of 'priority' and the necessary primitive functions for these data structures is crucial for effective implementation.
gruba
Messages
203
Reaction score
1

Homework Statement


Explain and compare two efficient implementations of a priority queue using binary tree.
Ilustrate this on an example of ascending priority queue that is created when elements
15, 38, 45, 21, 8, 55,20 are inserted and the two largest elements are deleted.

Homework Equations


3. The Attempt at a Solution [/B]
Could someone give some guidance on this question?
I don't need code, just an explanation.
 
Last edited:
Physics news on Phys.org
Can you say what aspects you do not understand? Are you familiar with binary trees? How do you interpret 'priority' in the context of the example? What primitive functions do you think will need to be performed on the data structure?
 
Back
Top