Algorithms and OOD (CSC 207 2014S) : EBoards

CSC207.01 2014S, Class 35: Priority Queues and their Basic Implementation


Overview

Preliminaries

Upcoming work.

Admin

Questions on the exam

What do you mean by "You can treat the height of the skip list as constant"

If your algorithm is O(height), it's O(1). (If you think carefully, height is about log_2(n).

How do we call the order comparator in problem 1?

int order = order.compare(val1, val2); if (order < 0) { // Code for "val1 precedes val2" } // (order < 0) else if (order == 0) { // Code for "the values are the same" } // (order == 0) else // (order > 0) { // Code for "val1 follows val2" } // (order > 0)

How do we get the last problem to work if we adding/removing elements cause iterators to fail?

Use set rather than add or remove.

A Summary of HW6

Implement queues with arrays, with wrapping.

Implement the "pretty output" parenthesis matching algorithm.

Implement an RPN calculator.

A few notes on priorities

Lab

Copyright (c) 2013-14 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.