This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The MIT License (MIT) | |
// | |
// Copyright (c) 2016 Jansel Valentin | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this implementation use xor to show the capability over pointers. | |
// let have 4 nodes A, B, C, D with their respective `next` pointer having | |
// a reference to the next and previous node(which make the list double linked). | |
// | |
// the linked list is built backward(new node become head). This implementation state that. | |
// | |
// A.pxor = B.xor(null) which is B. | |
// B.pxor = A.xor(C) which serve us to find both A & C | |
// C.pxor = B.xor(D) which serve us to find both B & D | |
// D.pxor = C.xor(null) which point to the prev node. |