CP164 Lecture Notes - Lecture 7: Priority Queue
Document Summary
Cp164 note 7: sort food by name (alphabetical, sorting numbers (lowest to highest, priority queue adt, the process of determining the priority of patients" treatments based on the severity of their condition. insert(): adds a new value to the priority queue. remove(): removes and returns the value with the highest priority value in the priority queue, if one exists. Values of equal priority are removed in the order in which they are added to the queue. peek(): return a copy of the value with the highest priority value in the priority queue without removing it, if one exists. is_empty(): returns true if the priority queue is empty, false otherwise. length(): returns the number of items in the priority queue. Need to know: do (cid:374)ot use pytho(cid:374) list (cid:373)ethod: (cid:858). re(cid:373)o(cid:448)e(cid:894)(cid:895)(cid:859) when doing assignments, walk through python list and find the smallest value (highest priority) and its index, we don(cid:859)t care what it is, we care where it is.