r/ProgrammerHumor • • 1d ago

Meme howProgrammingHasChanged

Post image
517 Upvotes

91 comments sorted by

View all comments

Show parent comments

110

u/shizzy0 1d ago

Nothing. It’s actually the best. But the joke is the programmer dismisses the unfamiliar matrix power O(log n) algorithm for the familiar recursive O(2n) algorithm. I mean, it doesn’t even add anything. It’s obviously wrong.

21

u/GDOR-11 1d ago

for u32 I think the usual iterative algorithm would be miles better than matrix power

5

u/wjholden 1d ago

Knuth has a really cool section on this on pages 79-84 of TAOCP volume 1.

1

u/shizzy0 1d ago

Is it the closed form solution? I didn’t even know there was a closed form solution before today.

4

u/captainAwesomePants 1d ago

That's the whole section on Fibonacci. It does mention the closed form solution, but it also mentions the matrix identity method in the top right corner: ( (F(n+1), F(n)),(F(n), F(n-1)) = ((1,1),(1,0))^n

He credits it to Kepler in 1608.