• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reversing a singly linked list  RSS feed

 
Wilson Gordon
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am looking for some ideas on how to reverse a singly linked list efficiently.

Thanks in advance.
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure how your linked list is represented internally, but maybe something like this will work:

Does that help at all?
[ June 29, 2007: Message edited by: Garrett Rowe ]
 
Wilson Gordon
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Garrett. That looks like a good algorithm!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!