Skip to content

Conversation

@Luke-Manyamazi
Copy link

@Luke-Manyamazi Luke-Manyamazi commented Nov 10, 2025

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

Changelist

  • Implemented push_head, pop_tail, and remove with O(1) complexity
  • Used node handles from push_head for direct removal in remove
  • Handles edge cases in pop_tail and remove for empty/single-element lists

Questions

  1. Are node objects from push_head suitable as handles for remove?
  2. Should we add utility methods like is_empty() alongside core functions?

@Luke-Manyamazi Luke-Manyamazi added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Complexity The name of the module. labels Nov 10, 2025
# node is tail
self.tail = node.previous

# Clean up references
Copy link

Choose a reason for hiding this comment

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

Why not also clean up reference in pop_tail()?

Copy link

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Just have one question.

@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 Jan 26, 2026
@Luke-Manyamazi
Copy link
Author

Good point, for consistency and safety, pop_tail() should also clean up node references, or better yet delegate to the common removal method so reference cleanup happens in one place.

@cjyuan
Copy link

cjyuan commented Jan 27, 2026

Sounds good. Well done.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jan 27, 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. Module-Complexity The name of the module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants