Regarding insertion at tail

shouldn’t the condition be:
if ( p>=len(head)) rather than
p>len(head) when inserting at end, where p is the position at which we have to insert, and len is the function to give length of the linked list??

hello @skaushik.46
it depends on indexing.
if u r using 0 based indexing then

this is correct.
for 1 based indexing

this is correct.

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.