Hi, The implementation is simple using 2 stacks, however we also need to make sure that if queue length is say x, we are able to enqueue x elements. As per my understanding, i could think of the solution using 4 stacks instead of 2(1 for enqueue, 1 for dequeue, 1 aux for enqueue, 1 aux for dequeue) . Is there any better approach.
Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
