2 2 votes if we implement queue using singly linked list then how juch time enqueue enqueue and dequeue will take ? Programming in C data-structures queue + – rahul sharma 5 10.7k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 5 5 votes Queue using singly Linked List, enqueue will take O(n) and Dequeue will take O(1) time. Because for enqueue operation, insert at the tail of the linked list and for dequeue remove from the beginning of the linked list (FIFO). but if we maintain an extra pointer both will take O(1). Manu Thakur answered Sep 28, 2017 • selected Nov 27, 2017 by rahul sharma 5 Manu Thakur comment Share Follow See all 2 Comments 2 2 Comments reply Kaluti commented Oct 15, 2017 reply Follow flag but what about that case when we have to delete the first node inserted after the n nodes in that case dequeue will take O(n) time correct if i am wrong 0 0 replyShare gulshan_ved commented Sep 5, 2020 reply Follow flag But then it ll not remain queue... 0 0 replyShare Please log in or register to add a comment.