Annotation of researchv10dc/vol2/anim/bst.gen, revision 1.1

1.1     ! root        1: awk '
        !             2: BEGIN {        n = 20; root = null = -1
        !             3:        for (i = 1; i <= n; i++)
        !             4:                root = insert(root, null, int(1000*rand()), 0)
        !             5: }
        !             6: function insert(p, pp, x, d) { # node p, parent pp, value x, depth d
        !             7:        if (p == null) {
        !             8:                val[p = ++nodecount] = x
        !             9:                lson[p] = rson[p] = null
        !            10:                if (pp != null) print "line", val[pp], 1-d, val[p], -d
        !            11:                print "text ljust", val[p], -d, "\"" x "\""
        !            12:                print "click insert"
        !            13:        } else if (x < val[p])
        !            14:                lson[p] = insert(lson[p], p, x, d+1)
        !            15:        else if (x > val[p])
        !            16:                rson[p] = insert(rson[p], p, x, d+1)
        !            17:        return p
        !            18: }
        !            19: '

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.