What is the space complexity for deleting a linked list?
A. O(1)
B. O(n)
C. Either O(1) or O(n)
D. O(long)
Answer:A
What is the space complexity for deleting a linked list?
A. O(1) B. O(n) C. Either O(1) or O(n) D. O(long)
Explanation: You need a temp variable to keep track of the current node, hence the space complexity is O(1).