diff options
Diffstat (limited to 'src/01')
| -rw-r--r-- | src/01/01a/README.md | 10 | ||||
| -rw-r--r-- | src/01/01a/priority_queue.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/01/01a/README.md b/src/01/01a/README.md index e69de29..5cd106a 100644 --- a/src/01/01a/README.md +++ b/src/01/01a/README.md @@ -0,0 +1,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). diff --git a/src/01/01a/priority_queue.h b/src/01/01a/priority_queue.h index 3228abd..17ca5ee 100644 --- a/src/01/01a/priority_queue.h +++ b/src/01/01a/priority_queue.h @@ -11,7 +11,6 @@ typedef struct { int size; } PriorityQueue; - PriorityQueue *initialize(); Node *create_node(int priority, int data); int size(PriorityQueue *queue); |
