Hi,
There is another solution for the same...
Use 2 pointers p1 and p2, initially both should point to the head.
Advance p1... one node at a time
Advance p2... two node at a time.
When p2 reaches the end, p1 is in the middle.
Thanks
Saby Abraham
User Profile
Collapse
Profile Sidebar
Collapse
sabitha
Last Activity: Feb 27 '07, 01:24 AM
Joined: Nov 11 '05
Location: Bangalore
Leave a comment: