|
|
1.1 ! root 1: record bnode(value,left,right) ! 2: ! 3: procedure btree(stree) ! 4: local x ! 5: stree ? if x := bnode(tab(upto('('))) then { ! 6: move(1) ! 7: x.left := btree(tab(bal(','))) ! 8: move(1) ! 9: x.right := btree(tab(bal(')'))) ! 10: } ! 11: else x := bnode(tab(0)) ! 12: return x ! 13: end ! 14: ! 15: procedure stree(btree) ! 16: local s ! 17: if /btree.left then return btree.value ! 18: s := btree.value || "(" || ! 19: stree(btree.left) || "," || stree(btree.right) || ")" ! 20: return s ! 21: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.