Question:
In a circular queue implemented using an array of size \(N\), what is the condition to detect that the queue is full?
आकार \(N\) के ऐरे का उपयोग करके लागू की गई सर्कुलर कतार (Circular Queue) में, कतार के पूर्ण (Full) होने का पता लगाने की शर्त क्या है?
Options:
- (rear + 1) % N == front
- rear == front
- (rear + 1) % N == 0
- rear == N – 1
- (rear + 1) % N == front
- rear == front
- (rear + 1) % N == 0
- rear == N – 1
Correct Answer: a)
Explanation:
In a standard circular queue, the condition for queue full is **\((\text{rear} + 1) \% N == \text{front}\)**, leaving one empty slot to distinguish between full and empty states (where empty is \(\text{front} == \text{rear}\)) (Option a).
सर्कुलर कतार के पूर्ण (Full) होने की स्थिति **\((\text{rear} + 1) \% N == \text{front}\)** होती है (विकल्प a)।