Describe the bug
When inserting nodes into a Red-Black Tree in sorted order, the tree collapses into a structure resembling a linked list. It is essential to optimize for this scenario; otherwise, the degenerated Red-Black Tree loses any advantages of being a balanced binary tree.
To Reproduce
Steps to reproduce the behavior:
const treeMS = new RbTreeMultimap<number, number>();
for (let i = 0; i < inputSize; i++) {
treeMS.add(i);
}
Describe the bug When inserting nodes into a Red-Black Tree in sorted order, the tree collapses into a structure resembling a linked list. It is essential to optimize for this scenario; otherwise, the degenerated Red-Black Tree loses any advantages of being a balanced binary tree.
To Reproduce Steps to reproduce the behavior: