What is the time complexity for searching on element in a doubly linked list and insertion of an element in a sorted linked list with n elements?
Open in App
Solution
Time complexity for searching in a doubly linked list O(n). Time Complexity for searching in a sorted linked list = O(n). Since linked list is sorted so in worst case insertion will take O(N).