List List: What is the list?

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
Published 25 original articles · won praise 3 · Views 488

Guess you like

Origin blog.csdn.net/qq_44045101/article/details/103264267