Skip to content

NW | 26-SDC-Mar | TzeMing Ho | Sprint 2 | implement_lru_cache#169

Open
TzeMingHo wants to merge 1 commit into
CodeYourFuture:mainfrom
TzeMingHo:coursework/implement_lru_cache
Open

NW | 26-SDC-Mar | TzeMing Ho | Sprint 2 | implement_lru_cache#169
TzeMingHo wants to merge 1 commit into
CodeYourFuture:mainfrom
TzeMingHo:coursework/implement_lru_cache

Conversation

@TzeMingHo

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

Changelist

  1. Borrowed the linked list from the previous exercise and made some updates
    1.1 Accepts a key, a value in the class Node
    1.2 Methods in class LinkedList accept Node
  2. Created class LruCache
  3. Created methods: get and set in class LruCache

@TzeMingHo TzeMingHo added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jun 17, 2026
def set(self, key, value):
if key in self.dict:
self.dict[key].value = value
self.get(key)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

With the current approach of moving a node to the front:

  • It is not immediately obvious why this method calls get()
  • Calling get() introduces an additional (but unnecessary) dictionary lookup

Could you explore a cleaner way to structure the code?

@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 Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants