使用python中的Linked List减去两个数字

问题描述 投票:-1回答:1

编写一个程序,在python给定的引导指针中减去以链表形式表示的两个数字。

python-3.x algorithm linked-list
1个回答
0
投票

我将假设你有一个链表的类,但是如果你需要自己定义其中一个,请告诉我。给定一个链表(比如LL),你可以说差别只是由头节点(引导指针)数据减去头后的节点。

在python中看起来像这样:

# assumed there is some linked list defined like LL
difference = LL.head.data - LL.head.next.data
© www.soinside.com 2019 - 2024. All rights reserved.