Preserve the radix tree root when deleting a branch - #15486
dhairyajangir wants to merge 1 commit into
Conversation
Multiple Pull Request Detected@dhairyajangir, we are extremely excited that you want to submit multiple algorithms in this repository but we have a limit on how many pull request a user can keep open at a time. This is to make sure all maintainers and users focus on a limited number of pull requests at a time to maintain the quality of the code. This pull request is being closed as the user already has an open pull request. Please focus on your previous pull request before opening another one. Thank you for your cooperation. User opened pull requests (including this one): #15487, #15486, #15485, #15484, #15483 |
|
Thanks for reviewing and merging #15483, #15484 and #15485. Those earlier PRs are now resolved, and I have no open PRs in this repository. This PR and #15487 were automatically closed for exceeding the simultaneous-PR limit. Would you be willing to reopen this radix-root fix for review now? I can keep the heap fix queued and focus on this one first. The existing regression evidence is in the description; I can add focused doctests or a benchmark if you would like them. I have left both PRs closed pending your guidance. |
Describe your change
Preserve the empty root node when deleting one of its last two branches. For example:
Deletion previously compressed the root into its remaining child, although lookup starts from an empty sentinel root. Only nodes with a nonempty prefix are now eligible for this compression. Non-root compression, prefix-word deletion, and complete deletion followed by reinsertion remain supported.
Existing doctests and unittest cases are unchanged as requested by the contribution guidelines. Validation on free-threaded CPython 3.15.0rc2:
pre-commit run --all-files --show-diff-on-failurepasses all applicable configured hooks.AI assistance was used to prepare this change. A separate agent review independently checked 100 deletion orders, non-root compression, deletion/reinsertion, and the existing tests.
Checklist
No new file or algorithm is added, and no issue is claimed. The existing doctests pass; this change adds no tests or functions to the algorithm file.