Linked list insertion

Hi sir I don’t understand the part of length in insertion in the middle in video of linked list Insertion ||

Hi @singhlakhbir7777
Pls share the code u are referring to… i will help u out…

from int length

hi @singhlakhbir7777
So using length of linked list and p we calculate where new node is to be inserted…
Suppose p is 0 then new node is inserted at head… if p is more than length of linked list then it is inserted at the end… else it’s inserted somewhere inside the linked list…
Thus calculating length is important.
Hope it clears your doubt …

1 Like

Thanks bro it is clear now

1 Like

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.