Skip to content

Conversation

@OlenaPyslar
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Great job on implementing the core functionality of the Dictionary class! The overall structure is solid. However, a couple of changes are needed to fully meet the project requirements.

First, the task description specifies that each node should store the key, hash, and value. Your current implementation in app/main.py only stores the key and value. Please update your node structure to include the pre-calculated hash.

Additionally, the KeyError you raise in __getitem__ is missing a descriptive message, which is a checklist requirement. It's important to provide context for the error, for example: raise KeyError(f"Key not found: {key}").

Once these two points are addressed, your solution will be fully compliant. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Great job addressing the previous feedback! Your Dictionary class is well-implemented and meets all the requirements, so I am approving your submission. The logic for handling nodes, including storing the hash and providing descriptive error messages, is solid.

As a small suggestion for future improvement, in your _resize method, you recalculate the hash of the key to find its new index. Since you already have the hash stored in the node, you can make this more efficient by using the stored value directly. This is a minor optimization, and your current code works perfectly. Keep up the fantastic work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

for bucked in self.table:
for node in bucked:
key, hash_key, value = node
new_index = hash(key) % new_capacity

Choose a reason for hiding this comment

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

You're recalculating the hash of the key here, but the hash_key is already available from the node you're processing. Consider using the stored hash to determine the new_index to make this more efficient and align with the purpose of storing the hash in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants