diff options
| author | mo khan <mo.khan@gmail.com> | 2020-06-29 13:07:00 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-06-29 13:07:00 -0600 |
| commit | 44394437c04390b5735654223c7f6ce6d0849799 (patch) | |
| tree | 602bc4ad67c0b4f8dcd032b7c2115da46ef27cee /src/01 | |
| parent | 7510ecbb65edfdb46a57169f3bedc21a3296dac5 (diff) | |
Add README for 1a.
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); |
