RSS

Simulate doubly linked list using single pointer

Fri, Mar 5, 2010

Algorithm

Store only one pointer=XOR(prev, next)
To traverse the list, one temp pointer needs to be set accordingly
To traverse forward, temp pointer should point to previous node, so next=EXOR(temp, node->link)
To traverse backward, temp pointer should point to next node, so next=EXOR(node->link, temp)

Sharing ~ Helping Other:
  • Print
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • BlinkList
  • DZone
  • Slashdot
  • YahooMyWeb
  • StumbleUpon
  • Live
  • IndianPad
  • DotNetKicks
  • Technorati

Other Posts:

This post was written by:

eXclusiveMinds - who has written 500 posts on eXclusiveMinds.


Contact the author

Leave a Reply

You must be logged in to post a comment.