Consider yourself to be in a planet where the computational power of chips to be slow. You have an array of size 10.You want to perform enqueue some element into this array. But you can perform only push and pop operations .Push and pop operation both take 1 sec respectively. The total time required to perform enQueue operation is?
A. 20
B. 40
C. 42
D. 43
Answer:D
Consider yourself to be in a planet where the computational power of chips to be slow. You have an array of size 10.You want to perform enqueue some element into this array. But you can perform only push and pop operations .Push and pop operation both take 1 sec respectively. The total time required to perform enQueue operation is?
A. 20 B. 40 C. 42 D. 43
Explanation: To begin, empty all of the current stack’s elements into the temporary stack, then push the necessary element and empty the temporary stack’s elements into the original stack. As a result, it takes 10+10+1+11+11=43 seconds.