quartz/content/notes/priority-queue.md
Jet Hughes 8a667e5693 update
2022-05-27 14:12:53 +12:00

16 lines
585 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
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
# Implementation
1. stores 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)
can be implemented using a [priority-queue](notes/priority-queue.md)