Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
enriquto
on Oct 28, 2019
|
parent
|
context
|
favorite
| on:
Ask HN: What is the most beautiful piece of code y...
the recursive "find" function on a disjoint set forest with path compression, by R.E.Tarjan. It brings tears to my eyes every time I read it.
int dsf_find(int *t, int a) { if (a != t[a]) t[a] = dsf_find(t, t[a]); return t[a]; }
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: