← 回題庫

卷別

資料結構

選擇

國立中央大學 2026 · 考試 · 第 4 題

If we use an array A0...N-1 to implement a circular queue, and use the variables front and rear, If the condition for a queue to be "empty" is front == rear, what is the condition for a queue to be "full"? (To distinguish between empty and full, one space is usually sacrificed.)

  • (A)
    (rear + 1) mod (N+1) == front
  • (B)
    (front + 1) mod (N-1) == rear
  • (C)
    (rear + 1) mod N == front
  • (D)
    (front + 1) mod N == rear

標準解析

AI 生成