Comparison costs of B-tree insertion #
insertQ instantiates insertM at FreeM (LEQuery α) with the query interface LEQuery.ask
and visit := pure (),
in the comparison-query model of Cslib.DataStructure.BTree.Comparisons.Query.
Insertion queries the order of keys to find the correct subtree during the downward search.
The splits on the way back up and the new root grown on overflow make zero comparisons,
because they only rebuild nodes using keys already compared and sorted.
At each node, scanning its rest contributes at most rest.length + 1 comparisons:
one per passed triple, with a possible second comparison at the stopping separator.
Main definitions #
insertQ: the instrumented insertion.
Main results #
eval_insertQ: the value ofinsertQunderorderOracleisinsert.countQueries_insertQ_le: insertion into a subtree makes at most2 * t * tr.height- comparisons under any oracle.
countQueries_insertQ_le_log: insertion into a well-formed tree- makes logarithmically many comparisons.
insertQ_upperBound: the exactUpperBoundpackaging forinsertQ.
References #
Counted B-tree insert operation.
Under the order's oracle, insertQ evaluates to the pure insertion insert.
Insertion into the empty tree makes zero comparisons.
Insertion makes at most 2 * t * height comparisons.
Insertion into a well-formed tree makes logarithmically many comparisons.
UpperBound packaging for insertQ.