COMS W3134 Lecture Notes - Lecture 19: Priority Queue, Binary Heap, Binary Tree

90 views5 pages

Document Summary

Lecture: chapter 6: priority queue, order is different than regular queue, first thing that comes out is highest priority piece of data in the structure. The lower the number, the sooner it comes off the queue: priority queues also referred to as heaps Where the minimum values come off first. Where the maximum values come off first. Implementing min-heap: array or anything that implements list e. g. linkedlist. Insert: order n (to find fitting spot to insert) Deletemin: order 1 (to delete first object) Insert: order 1 (tack object onto end of list: deletemin: order n (iterate through list to find the min, want to get rid of o(n) cost, looking for o(logn) cost for both methods. Insertion: must maintain min heap condition and completeness, can filled in from left to right at the very bottom level, or start a new level if bottom level is full.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents