Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 702 Bytes

README.md

File metadata and controls

16 lines (12 loc) · 702 Bytes

priority-queue

Sample implementation of a priority queue using a binary heap.

Rules followed:

  1. The queue must have an insert method which takes a number.
  2. If the number is not already present in the queue, it is added to the queue with a priority equal to the number.
  3. If the number is present, it's priority is increased by one.
  4. The queue must have a remove method which does not take any arguments, and removes and returns the number with the highest priority.
  5. The insert and remove functions should run in O(lg n)
  6. Assume that all inputs are safe.
  7. Don't pull in any external libraries.

TODO: Add documentation and lintify it.

- Created by Aaron C. Schafer on 8/30/2016.