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

feat: add duval's algorithm #2725

Merged
merged 4 commits into from
Oct 5, 2024
Merged

Conversation

aminegh20
Copy link
Contributor

Description of Change

Added the implementation of Duval's Algorithm for finding the lexicographically smallest cyclic shift of a sequence. The algorithm is based on the concept of Lyndon words and works in O(n) time, making it efficient for this type of task. This implementation is generic and works with various sequence types, such as strings, vectors, arrays, and deques.

Checklist

  • 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.

strings/duval.cpp Outdated Show resolved Hide resolved
strings/duval.cpp Show resolved Hide resolved
strings/duval.cpp Outdated Show resolved Hide resolved
strings/duval.cpp Show resolved Hide resolved
strings/duval.cpp Show resolved Hide resolved
strings/duval.cpp Show resolved Hide resolved
strings/duval.cpp Outdated Show resolved Hide resolved
strings/duval.cpp Show resolved Hide resolved
@realstealthninja realstealthninja added the requested changes changes have been requested label Sep 5, 2024
strings/duval.cpp Outdated Show resolved Hide resolved
strings/duval.cpp Show resolved Hide resolved
Copy link
Collaborator

@realstealthninja realstealthninja 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! thank you for this contribution

@realstealthninja realstealthninja added approved Approved; waiting for merge and removed requested changes changes have been requested labels Oct 5, 2024
Copy link
Collaborator

@realstealthninja realstealthninja left a comment

Choose a reason for hiding this comment

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

i would recommend adding std:: prefixes.

@realstealthninja realstealthninja changed the title Duval's algorithm for finding the lexicographically smallest cyclic shift in sequence. feat: add duval's algorithm Oct 5, 2024
@realstealthninja realstealthninja merged commit 60093d7 into TheAlgorithms:master Oct 5, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved; waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants