On 4/9/2011 2:50 PM, Bernd Oppolzer wrote:
> 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. 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.
As I mentioned earlier, I implemented Knuth's balanced tree algorithm in
assembler. While it could be done recursively, it does not need to be, as the
algorithm never requires keeping track of more than three nodes concurrently.
OTOH, reading the tree sequentially either requires a stack, or very inefficient
repositioning code.
G.P.
|