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 47 of 209[-]aurelian158 years ago1 reply#I really like Floyd's algorithm for sampling n elements without duplicates in linear time.https://fermatslibrary.com/s/a-sample-of-brilliancejustinpombrio8 years ago#That's a neat algorithm. You could also do part of a Fisher-Yates shuffle, if you're ok allocating the array.
Ask HN: What's your favorite elegant/beautiful algorithm?733 pointsby algobuddy (on Hacker News)8 years ago
aurelian158 years ago1 reply#I really like Floyd's algorithm for sampling n elements without duplicates in linear time.https://fermatslibrary.com/s/a-sample-of-brilliance
justinpombrio8 years ago#That's a neat algorithm. You could also do part of a Fisher-Yates shuffle, if you're ok allocating the array.
Comments (491) 209 threads
Show all comments
Showing thread 47 of 209
https://fermatslibrary.com/s/a-sample-of-brilliance