-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Negative Keys To Hashmap #297
base: master
Are you sure you want to change the base?
Conversation
PureTrippH
commented
Oct 7, 2023
- Changed the Remainder operation to a true modulus operation
- Enabled negative numbers in any Key Fields
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Nice! Can we constrain the key field to only take '-' and integers though? Right now you're able to input any string which leads to funky stuff. Screen.Recording.2023-10-08.at.12.13.23.PM.movYou could either add a constraint to the input field so that only those characters can be typed, or a constraint after submitting that causes the button to shake and displays a message saying "you can only input positive/negative integers" (similar to how it does now on some of the algos like sorting and pattern matching). |
Played around with these changes and it looks great!! I like that it automatically switches the hashing type if you put something different. Not sure if maybe non-alphanumeric keys like commas should still be filtered out, but up to you. |
Neg hash fix
Good stuff! I'm noticing that the True Hash Function type doesn't seem to let anything be entered (see gif here). Maybe this is an issue with line 267 in Hash.js where we set the desiredMode to either Nitpick: I can enter something like "3aaa" for the integer option as long as the first character is an integer, but I can't put "3aaa" for the string option. The first makes sense to allow duplicate numerical values although that's not super relevant in hashmaps. But for the second point, I think it would makes sense to allow any string including ones with leading integers - just maybe not integers by themselves since that could be confusing to users. Just a thought though, it's fine as is. If we can get the True Hash Function validation fixed then this is good to go! |
Yeah noticed that on my end. Looks like the repository is having some formatting issues and is conflicting with previous versions. Also, I have no idea how I just noticed the pull request like 4 months later xd |