Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
iiii90854yIs it some backwards fibonacci?
Also, why do you even use an array when all you need is only a few units to store intermediate values? -
@iiii it's regular fibo, I'm just exploring different methods of doing it.
I need an array, because fibo is O(log n), so I need a way to store all the numbers that need to be fibo'd. -
iiii90854y@pseudonim it seems like an incredibly inefficient method to gradually reduce a number into a huge array of ones and zeroes and then add them together.
BTW, case 0 and case 1 are identical: add to result. -
@iiii I'm just having fun mate, yes it's inefficient, I know that. But I'm just trying to stretch my brains to come up with different methods to calculate fibo. I don't think there's anything wrong with a little programming exercise.
-
iiii90854y@pseudonim to be honest, I'm just amused that such sequence even works as a legit fibonacci calculator.
-
@iiii why, it does exactly what the recursive fibo does, just it dumps the whole operation on the heap instead.
There's nothing really special about it, and to my understanding (haven't tested it yet), at large numbers, it could preform just as well (if not better) as the recursive fibo. -
@iiii mind explaining a bit? I think I get where your going, but I'm a bit to busy to figure it out rn.
-
iiii90854y@SortOfTested i don't like that term. non-descriptive. "recursion unwinding" is much better
-
iiii90854yActually, I could have removed that check at the top of the function and everything would have worked exactly the same
-
@SortOfTested that rant of yours was actually the inspiration for this little experiment.
-
@pseudonim
Sometimes it's fun to noodle on rube goldberg machines.
Who am I kidding, it's always fun.
Related Rants
Building on yesterday's rant (https://devrant.com/rants/3110183/), after sleeping on it I realized that using groups was completely non-necessary, so I got rid of them and got a much more efficient (and faster) function:
Also, I've got these in a repo: https://github.com/chabad360/...
rant
go
golang
fibonacci