mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 05:14:06 -06:00
auto update
This commit is contained in:
parent
611f6d0f94
commit
cbd1323c72
10
content/notes/09-stacks-and-queues.md
Normal file
10
content/notes/09-stacks-and-queues.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: "09-stacks-and-queues"
|
||||||
|
tags:
|
||||||
|
---
|
||||||
|
|
||||||
|
# 09-stacks-and-queues
|
||||||
|
|
||||||
|
- [[stacks-and-queues]]
|
||||||
|
- [[notes/priority-queue]]
|
||||||
|
- [[notes/heap]]
|
||||||
16
content/notes/priority-queue.md
Normal file
16
content/notes/priority-queue.md
Normal file
@ -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)
|
||||||
|
|
||||||
17
content/notes/stacks-and-queues.md
Normal file
17
content/notes/stacks-and-queues.md
Normal file
@ -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)
|
||||||
Loading…
Reference in New Issue
Block a user