can i implement same functionality by using one Stack only?
Can i implement same functionality by using one Stack only?
please describe what functionality you need to represent
queue-using-stack -dequeue efficient
No 2 stacks are required
Either it will be enqueue efficient or dequeue efficient
But not both
you mean , i can’t implement Queue functionality by using only one stack?
You can implement queue using a single user defined stack. However it will also use the function call stack so it will technically be using 2 stacks. Also this will not be dequeue efficient