1
1
If the MAX_SIZE is the size of the array used in the implementation of circular queue, assume array index start with O, front points towards the first element in the queue, and rear points towards the last element in the queue. Which of the following cond
If the MAX_SIZE is the size of the array used in the implementation of circular queue, assume array index start with O, front points towards the first element in the queue, and rear points towards the last element in the queue. Which of the following condition specify that circular queue is Full ?
1. Front = rear = - 1
2. Front = (rear + 1)%MAX_SIZE
3. Rear = front + 1
4. Rear = (front + 1)%MAX_SIZE
This Question has 1 answers.
Front = (rear + 1)%MAX_SIZE
A circular queue uses an array in a circular manner, meaning when rear reaches the last index (MAX_SIZE - 1), it wraps around to 0 if there is space.
- Front points to the first element, and rear points to the last element.
- The queue is full when inserting another element would overwrite the front element.
- This happens when the next position of rear (i.e., (rear + 1) % MAX_SIZE) is equal to front, indicating no space is left for a new element.
Similar Questions
- Point A is 30 metres to the east of point B. Point C is 10 metres to the south of Point A. Point D is 15 metres to the west of Point C. Point E is exactly in the middle of the Points D and F. Points D, E and F lie in a straight line. The length of the lin
- There are three taps A, B and C in a tank. They can fill the tank in 25 hrs, 20 hrs and 10 hrs respectively. At first all of them are opened simultaneously. Then after 1 hrs, tap C is closed and tap A and B are kept running. After the 4th hour, tap B is a
- In an alloy, zinc and copper are in the ratio 1 : 2. In the second alloy, the same elements are in the ratio 2 : 3. If these two alloys be mixed to form a new alloy in which two elements are in the ratio 5:8, the ratio of these two alloys in the new allow
- In a hotel, the rooms are numbered from 101 to 130 on the first floor, 221 to 260 on the second floor and 306 to 345 on the third floor. In the month of June this year, the room occupancy was 60% on the first floor, 40% on the second floor and 75% on the
- Are all the four friends viz. A, B, C and D who are sitting around a circular table, facing the centre? I) B sits second to right of D. D faces the centre. C sits to immediate right of both B and D. II) A sits to immediate left to B. C is not an immedia