Repository navigation
NW| 26-Jul-SDC | Ahmad Hmedan | Sprint 2 | Implement a linked list in Python - #227
Open
AhmadHmedann wants to merge 3 commits into
Open
AhmadHmedann wants to merge 3 commits into
AhmadHmedann wants to merge 3 commits into
Conversation
cjyuan
reviewed
Oct 9, 2026
| @@ -0,0 +1,60 @@ | |||
| class LinkedList: | |||
| class clsNode: | |||
There was a problem hiding this comment.
Suggestion: Look up "Python naming convention for inner class"?
Comment on lines
+3
to
+6
| def __init__(self, value): | ||
| self.next = None | ||
| self.previous = None | ||
| self.value = value |
There was a problem hiding this comment.
May I suggest exploring the use of __slots__ to reduce memory usage?
Comment on lines
+30
to
+37
| if self.head == self.tail: | ||
| self.head = None | ||
| self.tail = None | ||
| self.size -= 1 | ||
| return removed_value | ||
| self.tail = self.tail.previous | ||
| self.tail.next = None | ||
| self.size -= 1 |
There was a problem hiding this comment.
-
The
.nextand.previouswere cleared when a node is removed inremoved()but not in this method. (Inconsistency) -
You could consider delegating the node removing task to
remove()-- less code to maintain.
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 LinkedList class with push_head, pop_tail, and remove methods.