복습1 [자료구조] Queue 구현하기 큐(queue)는 컴퓨터의 기본적인 자료 구조의 한가지로, 먼저 집어 넣은 데이터가먼저 나오는 FIFO (First In First Out)구조로 저장하는 형식을 말한다. 출처 - 위키백과 구현하기 class Queue { private size = 0; private currSize = 0; private queue: Array = []; private first = 0; private rear = 0; constructor(size: number) { this.size = size; } enqueue(value: T): Queue { if (this.currSize >= this.size) { throw new Error('queue is overflow'); } this.queue[this.rear.. 2021. 3. 31. 이전 1 다음