Deletion at middle :
when the pos of node it not exist in the linked list then I have to delete the last node?
Because if the inspiration video of Prateek bhaiya if the pos is not exist then he is inserting the element at the tails of the node
Deletion at middle :
when the pos of node it not exist in the linked list then I have to delete the last node?
Because if the inspiration video of Prateek bhaiya if the pos is not exist then he is inserting the element at the tails of the node
Hey @Vikaspal its just for explanation if its cleared you can do anything delete last or insert last
as per the questions demand. its no issue
I hope your doubt is cleared . if yes dont forget to mark it resolved
@vatsal38 thanks brother
Actually I always assume pos=1 is the first node if someone says to delete the 0th node its simplify means no node exists head = NULL. Is this is the correct way of thinking because in arrays we always says the 0th element is 0 index values. Although I know we do whatever we want but what is the right way. ?
Hey @Vikaspal both are write some people call 0th pos the first in linklist while some 1st.
so it doesn’t really matter.
in the problems you will be given whether you have to take 0th index as first or not.
in array problems to some of the problems have 1 based indexing so you have to code accordingly.
i hope this clears your confusion