Skip to content

Add AhoCorasick #4465

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 45 commits into from
Oct 8, 2023
Merged

Add AhoCorasick #4465

merged 45 commits into from
Oct 8, 2023

Conversation

Prabhat-Kumar-42
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.

@Prabhat-Kumar-42
Copy link
Contributor Author

Hey,
I added code for the Aho-Corasick algorithm.
This code should work for all the test cases.
Please review it, if any issue arises, please let me know.
I hope It will help the community.
Thank You !! :)

@Manish-Rawat-1186
Copy link

bro how did you convert into clang format

@Prabhat-Kumar-42
Copy link
Contributor Author

bro how did you convert into clang format

Hey, below are the steps for clang.
You can format your code with the command (run it somewhere inside this project directory):

clang-format -i --style=file path/to/your/file.java

If you do not have the correct version of clang-format (i.e. < 16.0), you can remove this line:

InsertNewlineAtEOF: true

and add the new line symbol at the end of your file manually (but do not commit the changed .clang-format file).

If you use gitpod, everything should run smoothly there.

Originally posted by @vil02 in #4438 (comment)

@Prabhat-Kumar-42
Copy link
Contributor Author

Prabhat-Kumar-42 commented Oct 1, 2023

I request the maintainer(s) to please merge my request using "hacktoberfest-accepted" label.
Also, I would like to be assigned to this for any future issues or anything related.
Thank You !!

@Prabhat-Kumar-42 Prabhat-Kumar-42 requested a review from vil02 October 1, 2023 19:39
Copy link
Member

@vil02 vil02 left a comment

Choose a reason for hiding this comment

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

Interesting contribution!

The code is quite complex - it could be simplified by introducing some new helper methods. It is not easy, but we will make it perfect!

…ldNodesOfTheRoot() method, hashmap string search position (also has previous index based search), removed java.util.*
…into AhoCorasick

updated local repo with that of github
@Prabhat-Kumar-42 Prabhat-Kumar-42 marked this pull request as ready for review October 8, 2023 04:13
@Prabhat-Kumar-42
Copy link
Contributor Author

Hey @vil02 ,

I have updated the changes you have mentioned.

Please review the code.

If there's anything that needs to be modified, please let me know.

Thank You !!

@Prabhat-Kumar-42 Prabhat-Kumar-42 requested a review from vil02 October 8, 2023 04:16
@Prabhat-Kumar-42 Prabhat-Kumar-42 marked this pull request as draft October 8, 2023 10:24
@Prabhat-Kumar-42
Copy link
Contributor Author

Prabhat-Kumar-42 commented Oct 8, 2023

Hey @vil02 ,

I have updated the changes you have mentioned.

I tried what you said above about wrapping up pattern indexing in another class. I hope you like it.

Still If there's any thing that needs to be added or if you want me to revert it back to how it was, please do tell me. I will address it asap.

Please review the code.

Thank You !!

@Prabhat-Kumar-42 Prabhat-Kumar-42 marked this pull request as ready for review October 8, 2023 12:42
@Prabhat-Kumar-42 Prabhat-Kumar-42 requested a review from vil02 October 8, 2023 12:42
@vil02
Copy link
Member

vil02 commented Oct 8, 2023

@Prabhat-Kumar-42 wow, this was a pull-request. Thanks!

@vil02 vil02 changed the title #4464 - Implemented Aho-Corasick Algorithm Add AhoCorasick Oct 8, 2023
@vil02 vil02 merged commit 8200a79 into TheAlgorithms:master Oct 8, 2023
@vil02
Copy link
Member

vil02 commented Oct 8, 2023

Closes #4464.

@Prabhat-Kumar-42
Copy link
Contributor Author

Thanks @vil02 , It was fun working with you and I learned a lot in the process.
I am looking forward to contributing more and working with you.
Thank you again !!

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.

3 participants