please explain these question
I dont understand the 6,7,12
Hello @mohitsinghcould you please share the questions .
@mohitsingh
ques 6 -> derivation
ques 7
The worst case happens when the queue is sorted in decreasing order. In worst case, loop runs n*n times.
Queue: 4 3 2 1
Stack: Empty
3 2 1
4
3 2 1 4
Empty
2 1 4
3
2 1 4 3
Empty
1 4 3
2
1 4 3 2
Empty
4 3 2
1
3 2
1 4
3 2 4
1
2 4
1 3
2 4 3
1
4 3
1 2
3
1 2 4
3 4
1 2
4
1 2 3
Empty
1 2 3 4
@mohitsingh
question 12:
for first question NONE OF THEM is correct option.
reason if we push in beginning/end then we should pop from beginning/end only ( because stack follows LIFO property)