Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
您好!我刚刚开始学习您的《Python 算法与数据结构视频教程》,现在只是看程序,还没看视频。在“单链表”的程序“linked_list.py”里面,我发现一处bug,就是在删除链表中的某个节点时,如果这个链表就剩这一个节点了,也就是该节点是第一个,也是最后一个节点的时候,会出现
self.tailnode = prevnode = self.root
的情况,而本来应该为self.tailnode = None
的,这会造成一些问题。我写了测试代码,如下图所示,可以发现其中的问题。
换成修改后的代码,问题不会再出现,如下图所示。