Here we can use single link list by point tail node to second list head just till will be done in 0(1)
List concatination
Hey @sahil.gupta680 ,
Generally we are provided with just the head of the linkedList. In case, the tail node isn’t mentioned, you need to assume that the singly linked list doesn’t has a tail pointer.
Traversing to get the tail node in a singly linkedlist takes O(n) time and incase the tail node is provided, the concatenation can surely take place in O(1) time.
In case of circular doubly linkedlist, we can get the location of tail in constant time. and so it’ll be quicker to concat the 2 lists.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.