큐 : 선입선출 - 터널같은 구조
- 멀티 태스킹을 위한 프로세스 스케쥴링 방식 구현을 위해 많이 사용
출처 : https://ko.wikipedia.org/wiki/%ED%81%90_%28%EC%9E%90%EB%A3%8C_%EA%B5%AC%EC%A1%B0%29
public class Queue1 {
public static void main(String[] args) {
Queue<Integer> q = new LinkedList<>();
q.add(7);
q.add(5);
q.offer(4);
q.poll();
q.add(6);
q.poll();
while (!q.isEmpty()) {
System.out.print(q.peek() + " ");
q.poll();
}
}
}
'자료구조' 카테고리의 다른 글
[자료구조] 트리(Tree) (0) | 2023.01.18 |
---|---|
[자료구조] 해시(Hash) (0) | 2023.01.17 |
[자료구조] 연결리스트(LinkedList) (0) | 2023.01.04 |
[자료구조] 스택(Stack) (0) | 2023.01.03 |
[자료구조] 배열(Array) (0) | 2023.01.03 |