mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 13:24:05 -06:00
17 lines
520 B
Markdown
17 lines
520 B
Markdown
---
|
||
title: "priority-queue"
|
||
tags:
|
||
- cosc201
|
||
- datastructure
|
||
---
|
||
|
||
- 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)
|
||
|