Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A bit simplified code and update to Swift 5.1 #924

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

Closed
Kn1kt wants to merge 8 commits into kodecocodes:master from Kn1kt:master
Closed

A bit simplified code and update to Swift 5.1 #924

Kn1kt wants to merge 8 commits into kodecocodes:master from Kn1kt:master

Conversation

@Kn1kt
Copy link

@Kn1kt Kn1kt commented Apr 1, 2020

Checklist

Description

Fixed inconsistencies in Boyer-Moore-Horspool string search algorithm
Rewritten hash functions in Rabin-Karp string search algorithm
Simplified code in Knuth-Morris-Pratt String Search algorithm

Kn1kt added 5 commits April 1, 2020 17:06
In Horspool version we need skip ahead full pattern length (or less if character already met) when it not full match pattern
So in Horspool version we need need correctly fill length of skip of last character in pattern
At Swift 5.1 we can use built in hash function, so there is no need to use custom realisation
We just need to use overflow operators to not overflow Int
All code the same except hash function
if self[j] != pattern[q] { return nil }
}
return j
func index(of pattern: String, usingHorspoolImprovement: Bool = false) -> Index? {
Copy link

Choose a reason for hiding this comment

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

Indentation was changed from 4 spaces to 2 spaces, hiding any changes in this commit diff.

Style guide does say to use 2 spaces...

https://github.com/raywenderlich/swift-style-guide#spacing

But I would suggest fixing the indenting in a separate commit and/or PR, then making the algorithm changes in the next.

Copy link
Author

Choose a reason for hiding this comment

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

Now it's okay? Or maybe create one more PR?

Copy link

@pkamb pkamb Apr 2, 2020
edited
Loading

Choose a reason for hiding this comment

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

That does now make the "Files Changed" diff much easier to read.

Personally I would re-create or squash and re-push this branch to remove those indentation commits entirely from the git history, but others may have different opinions there. Not sure what the repo's standards are.

Copy link
Member

@kelvinlauKL kelvinlauKL Aug 29, 2020

Choose a reason for hiding this comment

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

Thanks for pointing this out @pkamb

Copy link

is this pull abandoned or will someone be doing an update on the conflict?

@Kn1kt Kn1kt closed this by deleting the head repository Aug 4, 2024
Copy link

iiicey commented Aug 4, 2024 via email

邮件已收到。我会尽快回复!祝您一切顺利!兰雨田

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kelvinlauKL kelvinlauKL kelvinlauKL left review comments

+1 more reviewer

@pkamb pkamb pkamb left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /