Home / CSE MCQs / Data Structure MCQs :: Discussion

Discussion :: Data Structure MCQs

  1. What is the time complexity of inserting a node in a doubly linked list?
  2. A.
    O(nlogn)
    B.
    O(logn)
    C.
    O(n)
    D.
    O(1)

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    In the worst case, the position to be inserted maybe at the end of the list, hence you have to traverse through the entire list to get to the correct position, hence O(n).


Be The First To Comment