Skip to content

Conversation

@lildonpancho
Copy link

@lildonpancho lildonpancho commented Oct 10, 2022

  • With the old code, the append method would exit on the first if statement every time because it was based on the count being equal to one. Instead, I changed it to check on index == 1 and removed it from the while loop. If this check fails, the code goes to the while loop, where it finishes when it reaches the desired node.

  • I fixed the double-linked list object's logic when deleting the head node. With the old logic, when the head node is deleted, head.prev was set to None before setting self.head = current.next. This caused the head.prev to point to the old self.head node that was supposed to be deleted.

  • Added an increase to the size for the append methods throughout all files.

  • Changed the count attribute to the size attribute for DoublyLinkedList to stay consistent with SinglyLinkedList.

@lildonpancho lildonpancho changed the title Fix logic for append_at_a_location() method Fixes for append and delete methods in linked list classes Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants