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


    Question

    To insert a new node at the beginning of a singly linked

    list, which of the following operations is typically performed?
    A Update the `next` pointer of the last node to point to the new node. Correct Answer Incorrect Answer
    B Update the `next` pointer of the new node to point to the current head, then make the new node the head. Correct Answer Incorrect Answer
    C Traverse the entire list to find the insertion point. Correct Answer Incorrect Answer
    D Shift all existing elements to make space for the new node. Correct Answer Incorrect Answer
    E Decrement the size of the list. Correct Answer Incorrect Answer

    Solution

    Update the `next` pointer of the new node to point to the current head, then make the new node the head.

    Practice Next
    ask-question