Skip to content

Glasgow | 26-Jul-SDC | Shreef Ibrahim | Sprint 2 | Implement a linked list - #253

Open
shreefAhmedM wants to merge 2 commits into
CodeYourFuture:mainfrom
shreefAhmedM:implementlinkedlistPy
Open

shreefAhmedM wants to merge 2 commits into
CodeYourFuture:mainfrom
shreefAhmedM:implementlinkedlistPy

Conversation

@shreefAhmedM

@shreefAhmedM shreefAhmedM commented Oct 14, 2026 •

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

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.

@github-actions

This comment has been minimized.

4 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@shreefAhmedM shreefAhmedM changed the title Glasgow | 26-Jul-SDC | Shreef Ibrahim | Sprint 1 Implement_linked_list_Python Glasgow | 26-Jul-SDC | Shreef Ibrahim | Sprint 1 Implement linked list Python Oct 14, 2026
@github-actions

This comment has been minimized.

@shreefAhmedM shreefAhmedM changed the title Glasgow | 26-Jul-SDC | Shreef Ibrahim | Sprint 1 Implement linked list Python Glasgow | 26-Jul-SDC | Shreef Ibrahim | Sprint 2 |implementlinkedlistPython Oct 14, 2026
@github-actions

This comment has been minimized.

@shreefAhmedM shreefAhmedM added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 14, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 14, 2026
@shreefAhmedM shreefAhmedM added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 16, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 16, 2026
@shreefAhmedM shreefAhmedM changed the title Glasgow | 26-Jul-SDC | Shreef Ibrahim | Sprint 2 |implementlinkedlistPython Glasgow | 26-Jul-SDC | Shreef Ibrahim | Sprint 2 | Implement a linked list Oct 16, 2026
@github-actions

This comment has been minimized.

@shreefAhmedM shreefAhmedM added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 16, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I suggest exploring the use of __slots__ to reduce memory usage?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok thank

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could consider delegating the node removing task to remove() -- less code to maintain.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 16, 2026
@shreefAhmedM shreefAhmedM added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 16, 2026
@cjyuan

cjyuan commented Oct 16, 2026

Copy link
Copy Markdown

Looks good.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants