📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    What is the time complexity for performing enqueue and

    dequeue operations on a queue implemented using a linked list?
    A O(n) for both Correct Answer Incorrect Answer
    B O(log n) for both Correct Answer Incorrect Answer
    C O(1) for both Correct Answer Incorrect Answer
    D O(1) for enqueue, O(n) for dequeue Correct Answer Incorrect Answer
    E O(n) for enqueue, O(1) for dequeue Correct Answer Incorrect Answer

    Solution

    With proper pointers (head and tail), both enqueue (adding to tail) and dequeue (removing from head) operations in a linked list implementation of a queue can be achieved in constant time, O(1).

    Practice Next
    ask-question