Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Ask HN: What's your favorite elegant/beautiful algorithm?. Parent comment
val someDS;
while(!someDS.isEmpty()){
addChildren(someDS.pop())
Now replace, someDs with
Queue -> BFS
Stack -> DFS
Priority Queue, with priority of distance so far -> Dijkstra.
Priority Queue, with distance + heuristic -> A*
Its beautiful.
There are no comments on this comment yet.
val someDS;
while(!someDS.isEmpty()){
}Now replace, someDs with
Queue -> BFS
Stack -> DFS
Priority Queue, with priority of distance so far -> Dijkstra.
Priority Queue, with distance + heuristic -> A*
Its beautiful.