Added matrix exponentiation approach for finding fibonacci number.#1042
Merged
cclauss merged 4 commits intoTheAlgorithms:masterfrom Jul 19, 2019
Merged
Added matrix exponentiation approach for finding fibonacci number.#1042cclauss merged 4 commits intoTheAlgorithms:masterfrom
cclauss merged 4 commits intoTheAlgorithms:masterfrom
Conversation
Contributor
mahbubcseju
commented
Jul 19, 2019
- Implemented matrix exponentiation for finding nth fibonnaci.
- Complexity is about O(nlog(n)*8), here 8 is for matrix multiplication of size 2 by 2.
cclauss
reviewed
Jul 19, 2019
* Implemented the way of finding nth fibonacci. * Complexity is about O(log(n)*8)
cclauss
requested changes
Jul 19, 2019
- Removed some extra spaces - Added the complexity of bruteforce algorithm - Removed unused function called zerro() - Added some docktest based on request
Member
from timeit import timeit
print(timeit("nth_fibonacci(1000)", "from __main__ import nth_fibonacci", number=10000))
print(timeit("nth_fibonacci_test(1000)", "from __main__ import nth_fibonacci_test", number=10000))1.565457206 |
Contributor
Author
Yes . If the input is high like n=100000, you will get the difference. |
Contributor
Author
from timeit import timeit |
cclauss
requested changes
Jul 19, 2019
Member
|
Perhaps the functions should be renamed to clarify intent:
|
24df2cd to
d30bbc1
Compare
Contributor
Author
Changed |
- Removed some extra spaces - Added the complexity of bruteforce algorithm - Removed unused function called zerro() - Added some docktest based on request
cclauss
added a commit
to cclauss/DroneFlight
that referenced
this pull request
Jul 19, 2019
As a thank you for the nice work on TheAlgorithms/Python#1042... These test will run on each update to the code. You will need to log into https://travis-ci.org/mahbubcseju using your github credentials to turn on this free service. This is a simple config (but it still catches one issue on Python 3). To see a more complex config, see https://github.com/TheAlgorithms/Python/blob/master/.travis.yml
Deus-Absconditus
added a commit
to Deus-Absconditus/Python
that referenced
this pull request
Nov 27, 2020
…heAlgorithms#1042) * Added matrix exponentiation approach for finding fibonacci number. * Implemented the way of finding nth fibonacci. * Complexity is about O(log(n)*8) * Updated the matrix exponentiation approach of finding nth fibonacci. - Removed some extra spaces - Added the complexity of bruteforce algorithm - Removed unused function called zerro() - Added some docktest based on request * Updated the matrix exponentiation approach of finding nth fibonacci. - Removed some extra spaces - Added the complexity of bruteforce algorithm - Removed unused function called zerro() - Added some docktest based on request * Tighten up main() and add comments on performance Signed-off-by: Deus-Absconditus <cnidus9@zohomail.com>
stokhos
pushed a commit
to stokhos/Python
that referenced
this pull request
Jan 3, 2021
…heAlgorithms#1042) * Added matrix exponentiation approach for finding fibonacci number. * Implemented the way of finding nth fibonacci. * Complexity is about O(log(n)*8) * Updated the matrix exponentiation approach of finding nth fibonacci. - Removed some extra spaces - Added the complexity of bruteforce algorithm - Removed unused function called zerro() - Added some docktest based on request * Updated the matrix exponentiation approach of finding nth fibonacci. - Removed some extra spaces - Added the complexity of bruteforce algorithm - Removed unused function called zerro() - Added some docktest based on request * Tighten up main() and add comments on performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.