컴공생의 다이어리
[자료구조] 큐(Queue) 본문
큐(Queue)
큐는 대기줄과 유사하다. 맛집의 줄을 서 있는 사람들이 있다고 할 때, 제일 먼저 들어갈 수 있는 사람은 먼저 온 사람이다(이때, 새치기는 없음). 나중에 줄을 선 사람은 마지막에 식당에 들어간다. 이러한 구조를 선입선출(FIFO, First In First Out)구조라고 한다.

파이썬 큐 예제
from collections import deque
# 큐 구현을 위해 deque 라이브러리 사용
queue = deque()
queue.append(5)
queue.append(1)
queue.append(4)
queue.popleft() # 제일 앞에 있는 원소(5) 제거
queue.append(7)
queue.append(2)
queue.popleft()
queue.append(3)
print(queue) # 먼저 들어온 순서대로 출력
queue.reverse()
print(queue) # 나중에 들어온 순서부터 출력
https://gohighbrow.com/stacks-and-queues/
Computer science: Stacks and Queues
Stacks and queues are special data structures that contain a specific set of rules. These rules are what define the data structure, giving them both pros and cons, and they are usually applied to either a linked list or array. It’s like a specialization.
gohighbrow.com
http://www.kyobobook.co.kr/product/detailViewKor.laf?mallGb=KOR&ejkGb=KOR&barcode=9791162243077
이것이 취업을 위한 코딩 테스트다 with 파이썬 - 교보문고
취업과 이직을 결정하는 알고리즘 인터뷰 완벽 가이드 | 이런 독자에게 권합니다.■ IT 직군의 취업 준비생 / 예비 개발자■ 이직을 준비하는 개발자■ 알고리즘 대회를 준비하는 학생[특징]코딩
www.kyobobook.co.kr
'Development > Algorithm & Coding Test' 카테고리의 다른 글
[프로그래머스] 모든 레코드 조회하기 - MySQL (0) | 2022.03.07 |
---|---|
재귀 함수(Recursive Function)란? (0) | 2021.12.29 |
[자료구조] 스택(Stack) (0) | 2021.12.27 |
[알고리즘] 선택 정렬(Selection Sort) (0) | 2021.10.16 |
[알고리즘] 거품 정렬(Bubble Sort) (0) | 2021.09.16 |