Showing posts with label priority heap. Show all posts
Showing posts with label priority heap. Show all posts

Dec 30, 2008

Given a constant number of priorities implement a priority queue with O(1) enqueue and dequeue implementations.

Given a constant number of priorities implement a priority queue with O(1) enqueue and dequeue implementations.

Use a hashtable, the key is priority level and the associated value is the linked list which maintains the objects with the same priority level. Also maintain a priority queue to record the priority levels, if a new level join, we update this priority queue, and if we want to dequeue, first get the max priority level from the priority queue and look up the key in the hash table. Enqueue is O(1), dequeue is O(1), while the priority levels are constant

Dec 24, 2008

Propose a tree based data structure to identify a node with mth rank with maximum efficiency .

Propose a tree based data structure to identify a node with mth rank with maximum efficiency .

priority heap
mLog(n) time to find mth max or min number, n is the number of nodes, m is the rank. To find max mth, use maxheap, to find min mth, use minheap