Just traverse the linked list from beginning to end, and invert the links.
Suppose you have a list :
elem1 -> elem2 -> elem3 -> ...
Then you start at the beginning :
elem1 -> elem2 -> elem3 -> ...
^
And come to this situation :
elem1 <- elem2 -> elem3 -> ...
^
And then you can do the same thing for the link between elem2 and elem3, etc.
Does that get you started ?
Can you give it a try, and post some code ?
Main Topics
Browse All Topics





by: bijopuliPosted on 2007-03-21 at 11:08:24ID: 18766026
Hi brassmon
.org.uk/~s gtatham/al gorithms/ r evlist.htm l edu/105/Li nkedListPr oblems.pdf rum/archiv e/index.ph p/t- 313473 .html bob_vanhoy /pdfs/less on34.pdf
These links should help u:
http://www.chiark.greenend
http://cslibrary.stanford.
http://www.codeguru.com/fo
http://www.mvhs.fuhsd.org/
Regards
Bijo.