13it33 - Data Structures MCQ Type Test Show 13it33 - Data Structures MCQ Type Test
You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list?
Answer is Discussion Forum
You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list? Answer: (C) Explanation: a) Can be done in O(1) time by deleting memory and changing the first pointer. b) Can be done in O(1) time, see push() here c) Delete the last element requires pointer to previous of last, which can only be obtained by traversing the list. d) Can be done in O(1) by changing next of last and then last. Quiz of this Question Practice Tags :
Please log in or register to answer this question.
Please log in or register to add a comment. |