From: "Bernd Oppolzer" <bernd.oppolzer@t-online.de>
Sent: Sunday, 10 April 2011 4:50 AM
> Many algorithms, for example quicksort or walking thru binary trees
> or inserting into balanced trees like AVL trees etc., need to be written
> as recursive functions or procedures.
They don't. For example, Quicksort can just as well be written without using
recursion; there is a perfectly good example (without using recursion) in Rich's
book, "Internal Sorthing Methods illustrated with PL/I programs", pp. 80ff.
That said, many algorithms for processing lists are written simply when
recursion is used. Even for Quicksort, the code is more succinct with recursion.
> If you want to do this in ASSEMBLER,
> you have to do all the housekeeping etc. to get the many incarnations of
> variables of the recursive invocations of that functions. Or, you need
> arrays
> to simulate the recursion stack etc., which means storage management.
> Anyway, you have to deal with it. This management has to be done by
> the ASSEMBLER programmer.
See above. No storage management is required.
|