I'm in the middle of a basic algorithms course.

The lectures talk about how in long runs of random insertions and deletions, the standard "Hibbard" delete will bias the tree shape, degrading the depth & performance of operations from log(N) to sqrt(N) (even if you randomly choose the left or right sub-tree to promote from, as described in the answer to this question).

The lectures also mention that people have been looking for a better delete method for 50 years.

I have an outline of an algorithm, below, that seems like it should be "unbiased".

So I have a few questions:

Am I just wrong and this is broken?

What is this algorithm called? (I doubt I've invented anything new here)

What is wrong with this that it is not the standard BST-delete?

My algorithm is simple, I also like the fact that you don't need to first implement delete-min/delete-max to implement delete.

Randomly inserting nodes into a BST results in an "unbiased" tree. When you delete a node, try to build the tree you would have had if the deleted node had never existed.

If nodes are timestamped it's easy, the older node should be promoted. But it's probably not worthwhile to time-stamp the nodes.

But it seems common enough for nodes to include the size of their sub-tree, this can be used to guess which node came in first.

Concretely:

If the deleted node has no children you're done. If it has 1 child promote the child, and you're done.

Otherwise, the deleted node's children were all added after it. One of the deleted node's children would have taken the position if the deleted node had never been inserted.

The sizes of the two children can be seen as samples from a binomial distribution. These can be used to easily estimate how likely nodes are to go left or right from the deleted node.

With that binomial probability choose randomly to promote the left or right subtree into the position of the deleted node (or just choose the largest?)

(Would automatically promoting the larger sub-tree have a chance of making the tree slightly shorter than expected for an unbiased tree?).

The un-promoted "Free" sub tree will flow left or right down the promoted sub-tree, because all it's nodes are either greater, or all less than any node in the promoted tree.

For each node the "Free" sub-tree encounters, disconnect the "Encountered" node's sub-tree from the main tree.

Pretend a node was just deleted in the "Encountered" node's place, and that the "Free" sub-tree, and the "Encountered" sub-tree are it's children, and recurse/loop