summaryrefslogtreecommitdiff
path: root/src/01/01a/README.md
blob: 5cd106ab07e523a7655ee9b56d6cde4d8db82db3 (plain)
1
2
3
4
5
6
7
8
9
10
# Assignment 1 - Question 1a - Computer Science 272: Data Structures and Algorithms

* Describe the meaning of the essential methods `add(x)`, `deleteMin()`, and `size()` that are supported by the priority queue interface.
* Implement those methods using a singly-linked list.
* Analyze the running time of the `add(x)` and `deletMin()` operations based on this implementation.
  * The `add(x)` method is used to add an element to the queue with a priority.
  * The `deleteMin()` method is used to remove the element with the lowest priority from the queue and return it.
  * The `size()` method is used to determine how many items are in the queue.
  * The `add(x)` function is linear time O(n).
  * The `deleteMin(x)` function is constant time O(1).