Skip to content

Conversation

@kokatesaurabh
Copy link

Implements the Aho-Corasick algorithm for efficient multi-pattern string searching in the strings/ directory. This adds support for finding multiple patterns in a text string in linear time O(n + m + z), where n is the text length, m is the total patterns length, and z is the number of matches. The implementation builds a trie for patterns, computes failure links via BFS, and traverses the text while collecting matches through output links. It is fully self-contained using STL (no external libs) and includes comprehensive Doxygen documentation, edge-case tests (empty inputs, no matches, overlaps), and asserts for verification. Inspired by standard algorithmic descriptions but rewritten from scratch for educational clarity—no direct code reuse from external sources.
This fills a gap in advanced string matching, complementing existing single-pattern algos like KMP and Rabin-Karp. Tested locally with CMake; all asserts pass.
Notes: Original implementation emphasizing trie construction and failure function for learning purposes. Commit follows semantic prefixes.

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Author has not responded to the comments for over 2 weeks label Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Author has not responded to the comments for over 2 weeks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant