|
|
|
|
|
by mqsiuser
4233 days ago
|
|
Hoare writes in his (famous) paper on quicksort (in 1962): "We'd implement our own recursion schema for perf reasons" Recursion is just a tree. Calling a function/procedure is expensive (in memory and run-time). Create a tree (e.g. linked list), base your recursion on that! You are not at university anymore, where you look at naive implementations for the sake of learning. Spoiler: I (actually do) resolve (function-call) recursion to (tree-based) recursion when I feel like I want to. Downvoters pls explain. |
|