| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
- const
- 알고리즘
- OOP
- pointer
- 백준
- programming
- 포인터
- Pre-processing
- pass by reference
- baekjoon
- 배열
- Python
- 반복문
- Data Science
- string
- predictive analysis
- 파이썬
- Object Oriented Programming
- 티스토리챌린지
- C++
- raw data
- assignment operator
- 오블완
- 문자열
- Deep Learning
- Class
- array
- function
- vscode
- 함수
- Today
- Total
Channi Studies
[ADT] Priority Queue Abstract Data Type 본문
[ADT] Priority Queue Abstract Data Type
Chan Lee 2025. 5. 9. 07:58Priority Queue ADT
A priority queue is a queue where each item has a priority, and items with higher priority are closer to the front of the queue than items with lower priority.
The priority queue enqueue operation inserts an item such that the item is closer to the front thatn all items of lower priority, and closer to the end than all items of equal or higher priority.
The priority queue dequeue operation removes and returns the item at the front of the queue, which has the highest priority.
In addition to enqueue and dequeue, a priority queue usually supports peeking and length querying.
A peek operation returns the highest priority item, without removing the item from the front of the queue.

Enqueueing items with priority
A priority queue can be implemented such that each item's priority can be determined from the item itself.
Ex. A customer object may contain information about a customer, including the customer's name and a service priority number. In this case, the priority resides within the object.
A priority queue may also be implemented such that all properties are specified during a call to EnqueueWithPriority: An enqueue opeariton that includes an argument for the enqueued item's priority.
In the followingf example, the priority doesn't reside within the object, but still act as a dependent priority variable for each object.

Implementing Priority Queues with Heaps
A priority queue is commonly implemented using a heap.
A heap will keep the highest priority item in the root node and allow access in O(1) time.
Adding and removing items from teh queue will operate in worst-case O(logN) time.

'Data Science > Data Structure & Algorithm' 카테고리의 다른 글
| [ADT] Set - 1 (0) | 2025.05.15 |
|---|---|
| [Data Structure] Treaps | 트립 (1) | 2025.05.09 |
| Abstract Data Type (ADT) V.S. Data Structure | 추상 자료형 vs 자료 구조형 (0) | 2025.05.09 |
| [Data Structure] Heap Sort (0) | 2025.05.08 |
| [Data Structure] Heaps Python Implementation (0) | 2025.05.08 |