Skip to content

Added the String Compression Algorithm #3911 #3916

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

Merged
merged 7 commits into from
Mar 19, 2023

Conversation

Swarga-codes
Copy link
Contributor

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.

Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

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

Please remove main, add JUnit tests, remove excessive comments, and decompose compress into smaller functions

@Swarga-codes
Copy link
Contributor Author

Should I remove the main function from the code and make a test file in the test folder for this particular algorithm?

@Swarga-codes
Copy link
Contributor Author

@siriak I made the necessary changes as u told on the PR, the changes include:

Reduce the size of code by dividing the code into smaller functions
Removed unnecessary comments
Removed the main
Included some Junit test cases for the code which you can access in the tests folder
Can you please check ?

@Swarga-codes
Copy link
Contributor Author

I made the necessary changes as per your instructions, that is:

  1. Changed the parameters for the checkCount function and passed the particular character rather than passing the entire array.
  2. Changed the name of the resulting string "res" to "compressedString".
  3. Changed the type of input from a character array to a string named "input".
  4. Changed the reference link from Leetcode to Wikipedia.
  5. Removed the unnecessary loop at the end as suggested.
  6. Changed the name of checkCount function to a more descriptive name, that is, appendCount, since we are appending the count to the resulting string.
  7. Changed the Junit test cases to parameterized Junit tests.
    Can you please check?

Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@siriak siriak merged commit 86c9314 into TheAlgorithms:master Mar 19, 2023
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