Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "XOR Linked List" Problem #83

Open
Manikant69 opened this issue Oct 12, 2024 · 1 comment
Open

Add "XOR Linked List" Problem #83

Manikant69 opened this issue Oct 12, 2024 · 1 comment
Assignees
Labels

Comments

@Manikant69
Copy link
Contributor

An XOR linked list is a memory-efficient version of a doubly linked list. Instead of storing the next and prev pointers explicitly, every node stores a value which is the XOR of the next and previous node's addresses. This allows the list to save space by using only one pointer for both next and prev.

In a regular doubly linked list, each node contains two pointers: one pointing to the next node and one pointing to the previous node. In an XOR linked list, a single field is used, which is the XOR of the addresses of the next and previous nodes.

The XOR operation can be used to derive the address of the next or previous node if the other node’s address is known.

Example:

Input: insert nodes with values 10, 20, 30, and 40 into an XOR linked list.

Output: 10 <-> 20 <-> 30 <-> 40

@aryanayush012
Copy link

I want to work on it
please assign me this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants