XOR Linked list is the memory efficient version of Doubly Linked list.
An ordinary Doubly Linked list needs 2 pointers - for next and previous elements.
XOR Linked list uses bitwise XOR operation to save the space (Keeps single pointer with XOR of both the pointers instead of 2 pointers)
EXAMPLE
Node1 : npx = 0 XOR pointer(Node1)
Node2 : npx = pointer(Node1) XOR pointer(Node2)
Node3 : npx = pointer(Node2) XOR pointer(Node3)
Node4 : npx = pointer(Node3) XOR 0
No comments:
Post a Comment
Note: only a member of this blog may post a comment.