From cbd1323c729970590aaf0ca258d6bea0a3b32ce5 Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Wed, 6 Apr 2022 22:54:35 +1200 Subject: [PATCH] auto update --- content/notes/09-stacks-and-queues.md | 10 ++++++++++ content/notes/priority-queue.md | 16 ++++++++++++++++ content/notes/stacks-and-queues.md | 17 +++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 content/notes/09-stacks-and-queues.md create mode 100644 content/notes/priority-queue.md create mode 100644 content/notes/stacks-and-queues.md diff --git a/content/notes/09-stacks-and-queues.md b/content/notes/09-stacks-and-queues.md new file mode 100644 index 000000000..8d79efe42 --- /dev/null +++ b/content/notes/09-stacks-and-queues.md @@ -0,0 +1,10 @@ +--- +title: "09-stacks-and-queues" +tags: +--- + +# 09-stacks-and-queues + +- [[stacks-and-queues]] +- [[notes/priority-queue]] +- [[notes/heap]] \ No newline at end of file diff --git a/content/notes/priority-queue.md b/content/notes/priority-queue.md new file mode 100644 index 000000000..c725fc587 --- /dev/null +++ b/content/notes/priority-queue.md @@ -0,0 +1,16 @@ +--- +title: "priority-queue" +tags: cosc201 datastructure +--- + +# priority-queue + +- A dynamic linear data type that supports addition and removal on entrie +- each entry hase a value and a priority (key) +- removal returns the item with the greatest priority + +## 1 Implementation + +1. stoes items and priorities in an array. Add at the end ϴ(1), remove by finding the maximum and exchaning with the end element ϴ(n) +2. stores items and their priorities in an array (or list) in sorted order. now removal is ϴ(1) bu addition in Ο(n) + diff --git a/content/notes/stacks-and-queues.md b/content/notes/stacks-and-queues.md new file mode 100644 index 000000000..42a584649 --- /dev/null +++ b/content/notes/stacks-and-queues.md @@ -0,0 +1,17 @@ +--- +title: "stacks-and-queues" +tags: +--- + +# stacks-and-queues + +Dynamic linear data types (interface) + +- an abstraction of a collection of data organised "in a line" which supprts addition of new elements and the removal of (some) old elements +- e.g., stacks and queues +- the difference in the removal operation + - stacks ⇒ (pop) LIFO + - queues ⇒ (remove, offer, pull) FIFO +- representation + - array (preffered because of memory management) + - linked list (seems more natural)