Skip to content

Add wildcard pattern matching using dynamic programming #5334

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 14 commits into from
Oct 20, 2021
Merged

Add wildcard pattern matching using dynamic programming #5334

merged 14 commits into from
Oct 20, 2021

Conversation

punithbajaj
Copy link
Contributor

@punithbajaj punithbajaj commented Oct 15, 2021

Describe your change:

  • added a regular expression algorithm in the dynamic programming folder
  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@punithbajaj punithbajaj requested a review from Kush1101 as a code owner October 15, 2021 22:43
@ghost ghost added the awaiting reviews This PR is ready to be reviewed label Oct 15, 2021
@cclauss
Copy link
Member

cclauss commented Oct 15, 2021

What is dp and why should your reader have to guess?

@ghost ghost added the tests are failing Do not merge until tests pass label Oct 15, 2021
@punithbajaj punithbajaj changed the title Added regular expression implimentation using dp Added regular expression implementation using dynamic programming Oct 16, 2021
@punithbajaj
Copy link
Contributor Author

Replaced dp with its full form Dynamic programming

@punithbajaj punithbajaj requested a review from cclauss October 16, 2021 10:19
@ghost ghost removed the tests are failing Do not merge until tests pass label Oct 16, 2021
@punithbajaj
Copy link
Contributor Author

@cclauss can you please add hacktober label to this and suggest changes if any.

@cclauss cclauss added hacktoberfest hacktoberfest-accepted Accepted to be counted towards Hacktoberfest labels Oct 19, 2021
@poyea
Copy link
Member

poyea commented Oct 19, 2021

Let's call this wildcard pattern matching under strings. It's tricky to classify this, as we have KMP and other algos under strings, but edit distance under DP. And I expect regex would work for groups and char sets as well, so it may be even better we discard those inputs in some way

@punithbajaj
Copy link
Contributor Author

@poyea Yes, as you said, now it makes sense to classify this under strings.

@punithbajaj punithbajaj requested a review from poyea October 19, 2021 07:50
@poyea
Copy link
Member

poyea commented Oct 19, 2021

@poyea Yes, as you said, now it makes sense to classify this under strings.

So, just put this file inside strings

@punithbajaj
Copy link
Contributor Author

@poyea Yes, as you said, now it makes sense to classify this under strings.

So, just put this file inside strings

moved this to strings

@punithbajaj punithbajaj requested a review from poyea October 19, 2021 10:29
@poyea
Copy link
Member

poyea commented Oct 19, 2021

@poyea Yes, as you said, now it makes sense to classify this under strings.

So, just put this file inside strings

moved this to strings

Change the filename as well? wildcard_pattern_matching.py

@punithbajaj
Copy link
Contributor Author

Change the filename as well? wildcard_pattern_matching.py

yes, changed it

@poyea poyea changed the title Added regular expression implementation using dynamic programming Add wildcard pattern matching using dynamic programming Oct 20, 2021
Copy link
Member

@poyea poyea left a comment

Choose a reason for hiding this comment

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

Thank you for your pull request!🤩

@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Oct 20, 2021
@poyea poyea added the awaiting merge This PR is approved and ready to be merged label Oct 20, 2021
@ghost ghost added awaiting reviews This PR is ready to be reviewed and removed awaiting merge This PR is approved and ready to be merged labels Oct 20, 2021
@punithbajaj punithbajaj requested a review from poyea October 20, 2021 08:18
Copy link
Member

@poyea poyea left a comment

Choose a reason for hiding this comment

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

Thank you for your pull request!🤩

@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Oct 20, 2021
@poyea poyea merged commit 83cf578 into TheAlgorithms:master Oct 20, 2021
shermanhui pushed a commit to shermanhui/Python that referenced this pull request Oct 22, 2021
…s#5334)

* Added regular expression implimentation using dp

* replaced input() with example values

* Apply suggestions from code review

Co-authored-by: Christian Clauss <[email protected]>

* changed returning value to bool and added test cases

* added doctest

Co-authored-by: John Law <[email protected]>

* added test cases

* Apply suggestions from code review

Co-authored-by: John Law <[email protected]>

* shifted to strings

* Changed filename

* Update function name to match_pattern

Co-authored-by: John Law <[email protected]>

* Update function name to match_pattern

Co-authored-by: John Law <[email protected]>

Co-authored-by: Christian Clauss <[email protected]>
Co-authored-by: John Law <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest hacktoberfest-accepted Accepted to be counted towards Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants