NodePractice2.py
From WLCS
class Node:
def __init__(self):
self.data = 0
self.next = None
#Draw the memory diagram of the following code
n1 = Node()
n2 = Node()
n2.next = Node()
n1.next = n2.next
n1.data = 2
n2.data = 4
class Node:
def __init__(self):
self.data = 0
self.next = None
#Draw the memory diagram of the following code
n1 = Node()
n2 = Node()
n2.next = Node()
n1.next = n2.next
n1.data = 2
n2.data = 4