Which line of this implementation of a queue should be changed in order to obtain a stack?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Both the insertion and deletion should be done at the top of the stack. It is the property of the queue, that the deletion will be done at bottom end which will be the first one queued. So line no 30 will be changed to top-- to pop the element out of the stack.