file:///home/garvit/Pictures/Screenshot%20from%202020-06-22%2020-53-36.png
file:///home/garvit/Pictures/Screenshot%20from%202020-06-22%2020-53-36.png
file:///home/garvit/Pictures/Screenshot%20from%202020-06-22%2020-53-36.png
file:///home/garvit/Pictures/Screenshot%20from%202020-06-22%2020-53-36.png
a) 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)
b) yeah stack should be correct option.
to convert recursive solution into iterative we take help of stack
okay thankyou
for the second question what should i do?
leave it ,the issue is from our side,will resolve it soon
okay thanks a lot for your help
also can you pls suggest some material for infix and postfix expressions…their interconversion and evaluation as there are ques in quiz but no material in course
check gfg. …
a) for first question -> derivation
b)
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
Thankyou sir…i have resolved the issue…thanks a lot for your help