May 2017
Intermediate to advanced
310 pages
8h 5m
English
The Python code that creates a class to capture what a doubly linked list node is includes in its initializing method, the prev, next, and data instance variables. When a node is newly created, all these variables default to None:
class Node(object): def __init__(self, data=None, next=None, prev=None): self.data = data self.next = next self.prev = prev
The prev variable holds a reference to the previous node, while the next variable continues to hold a reference to the next node.