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

A faster version of reverse recusion method #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

A faster version of reverse recusion method #21

wants to merge 3 commits into from

Conversation

Dannark
Copy link

@Dannark Dannark commented Sep 25, 2020

It will traverse from start and end at the same time for each iteration in order to use only half of the time.

It will traverse from start and end at the same time for each iteration in other to use only half of the time.
@Dannark
Copy link
Author

Dannark commented Sep 25, 2020

When running %timeit reverse('abcdefghijlmnopqstuvxyz1234567890abcdefghijlmnopqstuvxyz1234567890') The previous method took:

10000 loops, best of 3: 78.3 µs per loop

This one is taking:

100000 loops, best of 3: 12.7 µs per loop

The both methods were tested in colab :)

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

Successfully merging this pull request may close these issues.

1 participant