2020
10-10
10-10
python操作链表的示例代码
classNode:def__init__(self,dataval=None):self.dataval=datavalself.nextval=NoneclassSLinkList:def__init__(self):self.headval=None#遍历列表deftraversal_slist(self):head_node=self.headvalwhilehead_nodeisnotNone:print(head_node.dataval)head_node=head_node.nextval#表头插入结点defhead_insert(self,newdata):Newdata=Node(newdata)Newdata.nextva...
继续阅读 >