On Sat, Apr 01, 2017 at 03:56:08AM -0800, Christopher Howard wrote:
> tree as the primary data structure for managing game data. I wrote my
> own AA Tree implementation (with guidance from Wikipedia). I see the idx
> and balance functions in PicoLisp reference, but my concern is I don't
> see how you do with those an (efficient) self-balance after single
> inserts to an existing tree, nor how to do self-balancing deletes from
> an existing tree.
Right, 'idx' trees don't balance after every operation. Still, this is often not
a problem, and might be even more efficient than balancing algorithms if the
data are not too un-random.
As Joh-Tob said, you could also consider to 'balance' the list explicitly from
time to time.
A third option (which I would probably choose for such a game) is using the
database. Here you have B-Trees, which are always balanced. And other advantages
like persistence and multi-user synchronization.