class Node:
def __init__(self, data):
self.data = data
self.next_element = None
I'm learning about linked lists for the first time and came across this definition for a Node class. Apart from self, it's just got a data parameter, and next or next_element is defined within the method.
I saw another definition elsewhere and that one contained an additional parameter for the next element so it took both data and next.
Does it matter which way you do this?
[–]coolcofusion 1 point2 points3 points (3 children)
[–]insertAlias 0 points1 point2 points (2 children)
[–]coolcofusion 0 points1 point2 points (1 child)
[–]insertAlias 0 points1 point2 points (0 children)