FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Hamming Code for 32bit values by chrdek · Pull Request #1431 · TheAlgorithms/JavaScript · GitHub

feat: Hamming Code for 32bit values - #1431

Open
chrdek wants to merge 20 commits into
TheAlgorithms:masterfrom
chrdek:master
Open

feat: Hamming Code for 32bit values#1431
chrdek wants to merge 20 commits into
TheAlgorithms:masterfrom
chrdek:master

Conversation

chrdek commented Oct 4, 2023
edited
Loading

Copy link
Copy Markdown

 know more

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new JavaScript files are placed inside an existing directory.
  • All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
    Example:UserProfile.js is allowed but userprofile.js,Userprofile.js,user-Profile.js,userProfile.js are not
  • All new algorithms have a URL in their comments that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

chrdek added 4 commits October 4, 2023 14:58
Alternative with parity bit check.
Test suite for 32-bit values in different formats.
Added hamming code with parity value checks

chrdek left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Changed some code in HammingCode.test.js

chrdek left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

.

appgurueu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
  • It's not clear what you're trying to do here besides "hamming code". What is your dictionary (what are your code words, what do they decode to?). What is the hamming distance of your code words? Add useful comments, use better variable names.
  • The code is currently a mess. Please reformat it.
  • Don't use var, use let or const instead.
  • The tests should use each.

chrdek added 3 commits October 4, 2023 19:22
Refactored tests, usage of .each for most test cases.
Changes according to specs.
 - more understandable variable names/ comments etc.
- usage of let/const
Note: code refers to bit population count of a binary sequence

chrdek left a comment
edited
Loading

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

added:
more comments
understandable variable names, more info.
Tests: Refactored , now all vitest tests utilize each.

chrdek requested a review from appgurueu October 4, 2023 16:51

appgurueu left a comment
edited
Loading

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please implement my first review: Format the code, make it clear what you're doing and why.

This is a lookup-table accelerated software popcount. What does this have to do with hamming codes?

The unrelated triangular number change also does not belong here.

We also technically already have BinaryCountSetBits.js for this, but its implementation is pretty naive and I'd like to see it replaced.

chrdek left a comment
edited
Loading

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

As per initial request:

  • Included let,const in the codebase
  • Added more comments in-code
  • Changed the name to Hamming weight since it is the pop. count's more appropriate naming.
  • This algorithm can be easily extended for larger values as well.

And Remember: "JS code is like beer, under the same brand type there are different flavors and variations based on ingredients and fermentation process." Happy micro-brewing on your repo! cheers. 🍺🙃

chrdek requested a review from appgurueu October 9, 2023 14:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL