added fibonacci using formula along with test cases#1358
added fibonacci using formula along with test cases#1358raklaptudirm merged 9 commits intoTheAlgorithms:masterfrom dev-madhurendra:Fibonacci/Using-Formula
Conversation
appgurueu
left a comment
There was a problem hiding this comment.
Please add this to the existing Fibonacci.js file (and add the tests to the corresponding test file). Use a proper JSDoc comment. Also, use each for the test cases.
The formula doesn't need to be a comment, that's redundant with the implementation (also, the formula in the comment seems to differ from the one you implemented?). You can use x**y instead of Math.pow(x, y). Note also that Wikipedia suggests a slightly simpler formula for computation by rounding.
Side note: I find calling this O(1) time/space complexity slightly misleading; this is only (trivially) given because the numbers involved have constant size. If this were to use bigints / bigdecimals, it wouldn't be constant time anymore.
|
@appgurueu When I'll be able to merge this PR ? |
It's still waiting on a second review from @raklaptudirm. |
raklaptudirm
left a comment
There was a problem hiding this comment.
Sorry for the late review, but consider adding a resource to the formula used here.
Describe your change:
I added a code which calculates the nth fibonacci number using formula in a very less time.
Checklist:
Example:
UserProfile.jsis allowed butuserprofile.js,Userprofile.js,user-Profile.js,userProfile.jsare notFixes: #{$ISSUE_NO}.