Mathematical proofs with LaTeX and MathJax rendering
Statement: For a B-Tree of order $t$ (min degree) with $n$ keys, the height $h$ satisfies:
$$h \leq \log_t \frac{n+1}{2}$$
A B-Tree of height $h$ has at least:
Total minimum keys:
Corollary: Height is $O(\log_t n) = O(\log n)$ when $t$ is constant.
Statement: Searching in a B-Tree with $n$ keys takes $O(\log n)$ time.
Conclusion: B-Tree search has $O(\log n)$ time complexity.
Statement: Inserting into a B-Tree with $n$ keys takes $O(\log n)$ time.
Conclusion: B-Tree insert has $O(\log n)$ time complexity.
Statement: Deleting from a B-Tree with $n$ keys takes $O(\log n)$ time.
Conclusion: B-Tree delete has $O(\log n)$ time complexity.
Statement: A B-Tree with $n$ keys uses $O(n)$ space.
Conclusion: B-Tree space complexity is $O(n)$.
Statement: The amortized time per operation in a splay tree is $O(\log n)$.
Define potential function:
$$\Phi(T) = \sum_{v \in T} \log(\text{size}(v))$$
where $\text{size}(v)$ = number of nodes in subtree rooted at $v$.
For operation with actual cost $c$, amortized cost:
$$\hat{c} = c + \Delta\Phi$$
where $r(x) = \log(\text{size}(x))$ and $r'(x)$ is rank after operation.
Summing over all splay steps:
$$\text{Total amortized cost} \leq 3(r(\text{root}) - r(x)) + 1$$
Since $r(\text{root}) = \log(n)$ and $r(x) \geq 0$:
$$\text{Amortized cost} \leq 3\log(n) + 1 = O(\log n)$$
Conclusion: Splay tree operations have $O(\log n)$ amortized complexity.
Statement: Searching in an N-way splay tree with $n$ nodes takes $O(\log n)$ amortized time.
Conclusion: N-way splay tree search has $O(\log n)$ amortized time complexity.
Statement: Inserting into an N-way splay tree with $n$ nodes takes $O(\log n)$ amortized time.
Conclusion: N-way splay tree insert has $O(\log n)$ amortized time complexity.
Statement: Deleting from an N-way splay tree with $n$ nodes takes $O(\log n)$ amortized time.
Conclusion: N-way splay tree delete has $O(\log n)$ amortized time complexity.
Statement: Adjusting branching factor in an N-way splay tree takes $O(1)$ amortized time per operation.
Conclusion: Dynamic branching adjustment has $O(1)$ amortized time complexity.
Statement: An N-way splay tree with $n$ nodes uses $O(n)$ space.
Each node stores:
Number of nodes: $n$
Total pointers: at most $n \times \text{maxChildren}$
In worst case, $\text{maxChildren} = O(\sqrt{n})$ (by design constraint):
With dynamic branching adjustment, average branching factor is $O(1)$:
Conclusion: N-way splay tree has $O(n)$ average space complexity with dynamic branching, and $O(n\sqrt{n})$ worst-case space complexity.
Statement: Finding matching blocks using rolling checksum in splay tree takes $O(m \log n)$ time where $m$ is number of blocks to match and $n$ is number of stored blocks.
For each of $m$ blocks:
Total: $m \times O(\log n) = O(m \log n)$
Frequently matched blocks move to root, reducing average search time for common patterns.
Conclusion: Block matching has $O(m \log n)$ time complexity, with better average case for common patterns.
Statement: Building splay tree from file with $b$ blocks takes $O(b \log b)$ time.
For each of $b$ blocks:
Sum: $\sum_{i=1}^{b} \log i = \log(b!) = b \log b$ (by Stirling's approximation)
Conclusion: Rsync tree construction has $O(b \log b)$ time complexity.
Statement: Searching in a Circular Buffer Splay Tree with $n$ nodes takes $O(\log n)$ amortized time.
The search operation consists of:
Conclusion: Circular Buffer Splay Tree search has $O(\log n)$ amortized time complexity.
Statement: Inserting into a Circular Buffer Splay Tree with $n$ nodes takes $O(\log n)$ amortized time.
The insert operation consists of:
Conclusion: Circular Buffer Splay Tree insert has $O(\log n)$ amortized time complexity.
Statement: Deleting from a Circular Buffer Splay Tree with $n$ nodes takes $O(\log n)$ amortized time.
The delete operation consists of:
Conclusion: Circular Buffer Splay Tree delete has $O(\log n)$ amortized time complexity.
Statement: Sorting a Circular Buffer Splay Tree with $n$ nodes takes $O(n)$ time for both ascending and descending order, regardless of comparison mode (lexicographic, numeric, or semantic).
The sort operation performs an in-order traversal:
$T(n) = O(n \cdot k)$ where $k$ is the average key length.
Conclusion: Circular Buffer Splay Tree sort has $O(n)$ time complexity for fixed-size keys, and $O(n \cdot k)$ for variable-size keys where $k$ is the key length.
Statement: Thread-safe operations add $O(1)$ overhead per operation in the uncontended case.
Thread-safe operations involve:
When $k$ threads are waiting, lock acquisition is $O(k)$ worst case. However, with thread pool management, average overhead remains $O(1)$:
Conclusion: Thread-safe operations add $O(1)$ overhead per operation in the average case. For tree operations with $O(\log n)$ complexity, the $O(1)$ thread-safety overhead is dominated by the operation itself.