Please enable JavaScript.
Coggle requires JavaScript to display documents.
Heap & Queues - Coggle Diagram
Heap & Queues
Heap
I hope is another way to implement a priority queue it has a logical structure of a complete binary tree which satisfies the heat condition
I hope can be implemented using pointers each note 3-pointers parent left child and right child or more simply using a partially ordered array. in an array implementation where the highest priority key is in array position 1 we have
-
-
-
-
-
ordered array can be used but this would require more complication to maintain heaps make for a much more efficient implementation of a priority queue.
-
-
-
priority queue
a priority queue is a queue where each element has a priority and the element with the highest priority is put at the front of the queue this will be the first element to be removed to be contrast with the stack and queue data structures which use life o and 500 respectively
-
binary tree
-
a complete binary tree is a binary tree where new nodes are added from left to right on the same level and the new level is only added when the current level is full. there are no gaps anywhere in the tree between the first and last nodes
heap condition
the priority of any node is greater than or equal to that of its left child and right child if it has such child nodes