Back to front pageView on Hacker News (opens in a new tab)Ask HN: What's your favorite elegant/beautiful algorithm?733 pointsby algobuddy (on Hacker News)8 years agoComments (491) 209 threadsShow all commentsShowing thread 187 of 209[-]xyproto8 years ago1 reply#Memoizing the fibonacci function.todd88 years ago#Yeah that’s a great example of memoization. Also, the surprising: phi = (1 + sqrt(5))/2.0 def fib(n): return round(phi**n / sqrt(5))
Ask HN: What's your favorite elegant/beautiful algorithm?733 pointsby algobuddy (on Hacker News)8 years ago
todd88 years ago#Yeah that’s a great example of memoization. Also, the surprising: phi = (1 + sqrt(5))/2.0 def fib(n): return round(phi**n / sqrt(5))
Comments (491) 209 threads
Show all comments
Showing thread 187 of 209