0 0 votes Consider the following statements: S1 : Implementation of stack using queue, deletion of second element from top of stack time complexity Ο(n), when insertion take Ο(1) time. S2 : In implementation of queue using stack, deletion of second element from front take Ο(1) time, when insertion take Ο(n) time. Why both statements are correct Programming in C queue data-structures + – Shivi rao 1.3k views answer comment Share Follow Print See 1 comment 1 1 comment reply Ashwin Kulkarni commented Dec 12, 2017 reply Follow flag https://leetcode.com/articles/implement-stack-using-queues/ https://leetcode.com/articles/implement-queue-using-stacks/ These links will give you clear idea 2 2 replyShare Please log in or register to add a comment.
0 0 votes I think statement 1 is correct statement 2 is incorrect both the operation can be performed in O( 1 ) time. Avinash31 answered Jun 28, 2020 Avinash31 comment Share Follow 0 reply Please log in or register to add a comment.