根据Problem Solving with Algorithms and Data Structures using Python 一书用python实现链表 书籍在线网址http://interactivepython.org/runestone/static/pythonds/index.html 中文翻译书籍:https://facert.gitbooks.io/python-data-structure-cn/ class Node: #链表中单个节点的实现 def __init__(…
code #!/usr/bin/python # -*- coding: utf- -*- class ListNode: def __init__(self,x): self.val=x self.next=None def recurse(head,newhead): #递归,head为原链表的头结点,newhead为反转后链表的头结点 if head is None: return if head.next is None: newhead=head else : newhead=recu…