108
Suppose a circular queue of capacity (n— 1) elements is implemented with an array of n elements. Assume that the insertion
and deletion operation are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR =
FRONT = 0. The conditions to detect queue full and queue empty are:
EXPLANATION
Linear Data Structures
- Circular Queue Full and Empty Boundary Conditions:
- Consider a circular queue of capacity $n - 1$ implemented using an array of size $n$, with index pointers
FRONTandREAR: - One empty slot is reserved to distinguish between full and empty states.
- Empty Condition: When no elements reside in the queue:
- Full Condition: When inserting one more element would advance
REARto meetFRONT:
- Conclusion: Full: (REAR+1) mod n == FRONT, empty: REAR == FRONT (Option 1).
Correct option: (1) Full: (REAR+1) mod n == FRONT, empty: REAR == FRONT
Explanation not matching this question?
क्या व्याख्या इस प्रश्न से मेल नहीं खा रही?
Report
Want to practice this paper in exam conditions?
क्या आप परीक्षा जैसे माहौल में अभ्यास करना चाहते हैं?
Test yourself in 5-question batch format with timer and hidden answers.
5-प्रश्नों के बैच फॉर्मैट, टाइमर और छिपे उत्तरों के साथ खुद को परखें।
Start Practice Mode →
प्रैक्टिस टेस्ट मोड शुरू करें →