T Tam ca New member Sep 16, 2021 #1 What is the time complexity to count the number of elements in the linked list? A. O(1) B. O C. O(logn) D. O(n$^{2}$)
What is the time complexity to count the number of elements in the linked list? A. O(1) B. O C. O(logn) D. O(n$^{2}$)
N Nguyễn Ngọc Huỳnh New member Sep 16, 2021 #2 Answer: B Explanation: To count the number of elements, you have to traverse through the entire list, hence complexity is O. Upvote 0 Downvote
Answer: B Explanation: To count the number of elements, you have to traverse through the entire list, hence complexity is O.