Commit 3d11d0c
fix: correct treap split() comparison to match docstring behavior (#14762)
* fix: correct treap split() to match docstring for equal values (#7854)
The split() function in treap.py uses `<` comparison but the docstring states that the right subtree should contain values "greater or equal" to the split value. This fix changes `elif value < root.value:` to `elif value <= root.value:` so that equal values go to the right subtree as documented.
Fixes #7854
* Fix typo in Treap node docstringfix: remove accidental typo in Node class docstring
* Fix erase logic in treap.py
Adjust split logic to include the value in the right subtree.
---------
Co-authored-by: Christian Clauss <cclauss@me.com>1 parent 28dafc1 commit 3d11d0c
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
| 104 | + | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
0 commit comments