Skip to content

Commit f86d100

Browse files
authored
Refine docstring and variable comment in XOR linked list
Updated docstring for clarity and corrected 'ids' to 'IDs'.
1 parent 5d25a00 commit f86d100

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

data_structures/linked_list/xor_linked_list.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""
22
XOR Linked List implementation
3-
A memory-efficient doubly linked list using XOR of node addresses.
4-
Each node stores one pointer that is the XOR of previous and next node addresses.
3+
A memory-efficient doubly linked list that uses the XOR of node addresses.
4+
Each node stores one pointer that is the XOR of the previous and next node addresses.
5+
https://en.wikipedia.org/wiki/XOR_linked_list
56
Example:
67
>>> xor_list = XORLinkedList()
78
>>> xor_list.insert(10)
@@ -18,7 +19,7 @@ class Node:
1819
def __init__(self, value: int) -> None:
1920
"""Initializes a Node with a value and a null pointer."""
2021
self.value = value
21-
self.both: int = 0 # XOR of prev and next node ids
22+
self.both: int = 0 # XOR of prev and next node IDs
2223

2324

2425
class XORLinkedList:

0 commit comments

Comments
 (0)