Uh oh!
There was an error while loading. Please reload this page.
Fix bug for data_structures/linked_list/doubly_linked_list_two.py - #12651
Conversation
MaximSmolskiy
commented
Apr 1, 2025
@cclauss please review |
There was a problem hiding this comment.
Pull Request Overview
This pull request fixes a bug in the doubly linked list implementation where calling insert_at_position on an empty list caused an AttributeError. The key changes include updating the set_tail method to initialize the list when tail is absent, refining the insert_after_node type hints, and switching to set_tail in insert_at_position to handle empty lists correctly.
Comments suppressed due to low confidence (1)
data_structures/linked_list/doubly_linked_list_two.py:108
- The function signature now strictly requires a non-null node. Ensure that all calls to insert_after_node have been updated accordingly so that a None value is never passed in, as this could lead to runtime errors.
def insert_after_node(self, node: Node, node_to_insert: Node) -> None:
Uh oh!
There was an error while loading. Please reload this page.
cclauss
left a comment
There was a problem hiding this comment.
Approved but please review Copilot’s review.
MaximSmolskiy
commented
Apr 2, 2025
@cclauss Good review from Copilot - good description and 2 good comments |
…eAlgorithms#12651) * Fix bug for data_structures/linked_list/doubly_linked_list_two.py * Fix * Fix * Fix * Fix * Fix * Fix * Fix * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py * Update doubly_linked_list_two.py
Describe your change:
Related to #12647
Bug was when calling
insert_at_positionmethod on empty listChecklist: