Skip to content

Complete Design-1#2628

Open
PrakarshKamal wants to merge 1 commit intosuper30admin:masterfrom
PrakarshKamal:master
Open

Complete Design-1#2628
PrakarshKamal wants to merge 1 commit intosuper30admin:masterfrom
PrakarshKamal:master

Conversation

@PrakarshKamal
Copy link

No description provided.

@super30admin
Copy link
Owner

Strengths:

  • The MyHashSet implementation is correct and efficient, using double hashing to handle collisions.
  • The code is clean, with well-named variables and methods.
  • The comments in the code are helpful, though minimal.

Areas for Improvement:

  • The submission includes an extra file (MinStack.java) that is not required for this problem. This suggests a possible mix-up in the submission. For future submissions, ensure only the relevant code is provided.
  • While the MyHashSet code is correct, it would be beneficial to add a brief comment explaining why the secondary bucket size is increased by one for the primary index 0. This is because the key range goes up to 10^6, and when key=10^6, the primary hash would be 0 (since 10^6 % 1000 = 0) and the secondary hash would be 1000 (10^6 / 1000 = 1000). Without the extra bucket, this would cause an index out of bounds error. A comment would clarify this design decision.
  • Consider using final modifiers for primaryBuckets and secondaryBuckets since they are constants and should not change.

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