MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / find_position

Method find_position

python/bplustree/bplus_tree.py:736–744  ·  view source on GitHub ↗

Find where a key should be inserted. Returns (position, exists) where exists is True if key already exists.

(self, key: Any)

Source from the content-addressed store, hash-verified

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 """

Callers 6

insertMethod · 0.95
getMethod · 0.95
deleteMethod · 0.95
_insert_into_leafMethod · 0.45
__contains__Method · 0.45

Calls

no outgoing calls

Tested by 1