finding middle node in liked list
how to find the middle node of the linked list having some 10 nodes....i dont want to count the nodes n find the middle one....i have to travel the entire list for only one time....after coming to the end of the node ,i have to recpgnise n print the middle node
thanks n regards
Re: finding middle node in liked list
The best possible way out is do have a pointer to the middle node at the time of inserting as you can never know which one is the middle node unless you travel the whole list.
You can also try one more thing is while travelling to find the middle node store the middle node to the particular node and when you will reach the end of the list you have the middle node stored.
|All times are GMT +5.5. The time now is 07:09.|