Skip to content
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

Manacher's Algorithm #11

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

dlesnoff
Copy link
Collaborator

Manacher's Algorithm finds the longest palindromic factor (substring) in linear time in the length of the string input.

@Panquesito7 Panquesito7 added the enhancement New feature or request label Apr 26, 2023
Copy link
Member

@SatinWukerORIG SatinWukerORIG left a comment

Choose a reason for hiding this comment

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

Well done! I like your raising error operations. Very clear comments, but just a few suggestions.

strings/manacher.nim Outdated Show resolved Hide resolved
strings/manacher.nim Outdated Show resolved Hide resolved
strings/manacher.nim Outdated Show resolved Hide resolved
strings/manacher.nim Show resolved Hide resolved
strings/manacher.nim Show resolved Hide resolved
strings/manacher.nim Show resolved Hide resolved
strings/manacher.nim Show resolved Hide resolved
strings/manacher.nim Outdated Show resolved Hide resolved
@dlesnoff
Copy link
Collaborator Author

dlesnoff commented Jul 7, 2023

@SatinWuker Is it working on your side?

@SatinWukerORIG
Copy link
Member

@SatinWuker Is it working on your side?

It works really well 👍👍👍 thank you for your clear explanation and helpful comment on the file haha!

@dlesnoff
Copy link
Collaborator Author

dlesnoff commented Jul 9, 2023

As one may notice, I compute the indexes whenever I ask for the length and the string.
This might impact performance for very long strings. We may prefer to pass the indexes as parameters and determine the length or the string itself from this precomputed argument.
A better way to handle this would be to compute an object with None/Option[T] attributes, that we fill with precisely the information we want.

@dlesnoff
Copy link
Collaborator Author

dlesnoff commented Jul 9, 2023

@SatinWuker

It works really well +1+1+1 thank you for your clear explanation and helpful comment on the file haha!

Do you still require the variable name changes or would you like to approve the pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants