Consider a dequeue of size 10. The values of Front and Rear are Front=2 and Rear=5. Insert at Front, Insert at Rear, Insert at Rear, Remove at Front, Remove at Front, Insert at Rear, Insert at Front, Remove at Rear, Remove at Rear
Answers
Answered by
0
Answer:
SORRY
Explanation:
I NEED SOME POINTS
Answered by
0
Given :
Size of dequeue = 10
Front = 2
Rear = 5
Performing the following operation :
- Insert at Front
- Insert at Rear
- Insert at Rear
- Remove at Front
- Remove at Front
- Insert at Rear
- Insert at Front
- Remove at Rear
- Remove at Rear
1) Insert at Front
Front = Front -- = 2 -- = 1
So, Front = 1
2) Insert at Rear
Rear = Rear ++ = 5 ++ = 6
So, Rear = 6
3) Insert at Rear
Rear = Rear ++ = 6 ++ = 7
So, Rear = 7
4) Remove at Front
Front = Front ++ = 1 ++ = 2
So, Front = 2
5) Remove at Front
Front = Front ++ = 2 ++ = 3
So, Front = 3
6) Insert at Rear
Rear = Rear ++ = 7 ++ = 8
So, Rear = 8
7) Insert at Front
Front = Front -- = 3 -- = 2
So, Front = 2
8) Remove at Rear
Rear = Rear -- = 8 -- = 7
So, Rear = 7
9) Remove at Rear
Rear = Rear -- = 7 -- = 6
So, Rear = 6
So, after execution of all these instructions Front = 2 and Rear = 6
Similar questions