In the previous discussion of the basic data structure, we use Python List to achieve more linear data structure
List List is a simple and powerful data set structure, provides a rich user interface.
But not all programming languages provide a List data type, and sometimes require the programmer to achieve
List implementation: Node Node
The most basic elements of the list is implemented nodes Node
Each node contains at least two pieces of information to: data item itself and the reference information pointing to a next node
Note next to no sense None of the next node
class Node:
def __init__(self, initdata):
self.data = initdata
self.next = Node
def getData(self):
return self.data
def setData(self, newdata):
self.data = newdata
def setNext(self, newnext):
self.next = newxext