What is the time complexity of inserting a new node after kth element in a single linked list of n nodes?
Note: only head pointer is given.
To insert a new node after kth element, we have to traverse k nodes by comparing. so no of comparisons is only k. so it is O(k)
Back To Top