Find where a key should be inserted. Returns (position, exists) where exists is True if key already exists.
(self, key: Any)
| 734 | self.next = right_sibling.next |
| 735 | |
| 736 | def find_position(self, key: Any) -> Tuple[int, bool]: |
| 737 | """ |
| 738 | Find where a key should be inserted. |
| 739 | Returns (position, exists) where exists is True if key already exists. |
| 740 | """ |
| 741 | # Use optimized bisect module for binary search |
| 742 | pos = bisect.bisect_left(self.keys, key) |
| 743 | exists = pos < len(self.keys) and self.keys[pos] == key |
| 744 | return pos, exists |
| 745 | |
| 746 | def insert(self, key: Any, value: Any) -> Optional[Any]: |
| 747 | """ |
no outgoing calls