Repository navigation
Glasgow | 26-Jul-SDC | Shreef Ibrahim | Sprint 2 | Implement a linked list - #253
Open
shreefAhmedM wants to merge 2 commits into
Open
shreefAhmedM wants to merge 2 commits into
shreefAhmedM wants to merge 2 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
4 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cjyuan
reviewed
Oct 16, 2026
cjyuan
left a comment
There was a problem hiding this comment.
Could consider adding type hints to each method to clearly specify the types of its parameters and return value.
Comment on lines
+1
to
+5
| class Node: | ||
| def __init__(self, value): | ||
| self.value = value | ||
| self.next = None | ||
| self.previous = None |
There was a problem hiding this comment.
May I suggest exploring the use of __slots__ to reduce memory usage?
Comment on lines
+33
to
+40
| if self.head == self.tail: | ||
| self.head = None | ||
| self.tail = None | ||
| else: | ||
| self.tail = self.tail.previous | ||
| self.tail.next = None | ||
|
|
||
| popped_node.previous = None |
There was a problem hiding this comment.
Could consider delegating the node removing task to remove() -- less code to maintain.
|
Looks good. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Learners, PR Template
Self checklist
Task code
CYF-1180
Changelist
Implemented a Doubly Linked List in linked_list.py using Node and LinkedList classes. Achieved O(1) worst-case time complexity for core operations, including push_head, pop_tail, and remove. Handled edge cases involving head, tail, middle, and single-node removal. Verified the implementation by successfully passing all unit tests in linked_list_test.py.