Day #6: XOR Doubly Linked List

I am a Software Engineer from Hyderabad. Here to learn and share what I learn.
Search for a command to run...

I am a Software Engineer from Hyderabad. Here to learn and share what I learn.
No comments yet. Be the first to comment.
Hello everyone. Today is the Day 7 of the #100DaysOfCodeChallenge. And it's a week!!!! Received a problem previously asked by Facebook with a hard tag to it. The Question On Day #6: Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, ...
Unveil Your Brilliance with DIY Portfolio – Your Personalized Showcase, One File Edit Away!

Building a backend server application using Node.js, Express and JDoodle API to execute scripts and return the output as response.

Learning how to create mind maps to understand what's needed for the project and setting up the project folder with required dependencies quickly.

A series of articles on how to build a simple web app which serves an online IDE using the MERN stack to run code in multiple languages.

Hello everyone. Today is the Day 8 of the #100DaysOfCodeChallenge. Received a problem previously asked by Google with an easy tag to it. The Question On Day #8: A unival tree (which stands for "universal value") is a tree where all nodes under it hav...

Hello. Today is the Day 6 of the #100DaysOfCodeChallenge. Received a problem previously asked by Google with a hard tag to it.
An XOR linked list is a more memory efficient doubly linked list. Instead of each node holding next and prev fields, it holds a field named both, which is an XOR of the next node and the previous node. Implement an XOR linked list; it has an add(element) which adds the element to the end, and a get(index) which returns the node at index.
Doing it on C++, since pointer implementation on Python is messy and not efficient.
Output
Nodes:
40 30 20 10
Not getting much into the details of the logic, the wikipedia reference speaks it all.
You can look into the visualiser to understand the BTS of the logic here.
Feel free to reach out for any query clearance.
Thanks and cheers:)