Profile

Queue

FIFO (First In, First Out) 또는 선입선출 자료구조를 큐 (Queue) 라고 한다.

큐의 특징

Front : 큐의 가장 앞 요소 (데이터 출력시 가장 처음으로 나오게될 데이터)
Rear : 큐의 가장 마지막 요소 (데이터 출력시 가장 마지막으로 나오게될 데이터)
class Queue: def __init__(self): self.queue: List[Any] = [] def enqueue(self, data: Any): self.queue.append(data) def dequeue(self) -> Any: if not self.queue: return None return self.queue.pop(0)
Python

순환 큐

배열로 구현

링크드 리스트로 구현