Queue

SangJun·2022년 10월 23일
0

자료구조

목록 보기
12/18

QUEUE란?

FIFO(First In First Out) 특성을 가지는 자료구조.

  • Ordered linear list.
  • One end is called front.(dequeue는 여기서)
  • Other end is called rear.(enqueue는 여기로)
  • Additions are done at the rear only.
  • Removals are made from the front only.

Queue Operations

  • IsFullQ ...return true iff queue is full
  • IsEmptyQ ...return true iff queue is empty
  • AddQ ...add an element at the rear of the queue
  • DeleteQ ...delete and return the front element of the queue.

Circular Queue

장점: 1D array 큐에서 dequeue를 했을 때 생기는 메모리 낭비를 막을 수 있음.

rear = (rear+1) % M(array 공간의 개수)

profile
Let there be bit.

0개의 댓글