<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.algo.informatik.tu-darmstadt.de/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lkw</id>
	<title>Algowiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.algo.informatik.tu-darmstadt.de/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lkw"/>
	<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/Special:Contributions/Lkw"/>
	<updated>2026-04-22T12:14:38Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Main_Page&amp;diff=2704</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Main_Page&amp;diff=2704"/>
		<updated>2014-12-26T17:35:16Z</updated>

		<summary type="html">&lt;p&gt;Lkw: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== News ==&lt;br /&gt;
* The http://wiki.algo.informatik.tu-darmstadt.de domain will forward to this page from 13th October.&lt;br /&gt;
* The old wiki will be reachable at http://huffmann.algo.informatik.tu-darmstadt.de/wiki/&lt;br /&gt;
* &amp;lt;math&amp;gt;LaTeX&amp;lt;/math&amp;gt; [http://www.mediawiki.org/wiki/Manual:Math available now!]&lt;br /&gt;
* ToDo List added&lt;br /&gt;
* Every content has to be in English!&lt;br /&gt;
* [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi Syntaxhighlight]&lt;br /&gt;
&lt;br /&gt;
== Rules ==&lt;br /&gt;
* Add finalized reconstructions of the old Wiki to Category:Checkup.&lt;br /&gt;
* Don't any non-Weihe content until the reconstructions isn't finished.&lt;br /&gt;
* Keep your active reconstructing Pages in &amp;quot;Division of labor&amp;quot; section up to date!&lt;br /&gt;
&lt;br /&gt;
'''Look here for short/uncomplete Pages''' [[Special:ShortPages]]&lt;br /&gt;
&lt;br /&gt;
== Page Status ==&lt;br /&gt;
Final: [[:Category:Checkup]]&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
=== Notations ===&lt;br /&gt;
* [[Big O notation]]&lt;br /&gt;
* [[L' Hospital]]&lt;br /&gt;
* [[Master theorem]]&lt;br /&gt;
&lt;br /&gt;
=== Problems ===&lt;br /&gt;
* [[Matchings in graphs#Cardinality-maximal matching|Maximum matching problem]]&lt;br /&gt;
* [[Max-Flow Problems]]&lt;br /&gt;
* [[Min-Cost Flow Problems]]&lt;br /&gt;
* [[Shortest Paths Problems]]&lt;br /&gt;
** [[All pairs shortest paths]]&lt;br /&gt;
*** [[Floyd-Warshall]]&lt;br /&gt;
*** [[Bellman-Ford]] (DONE)&lt;br /&gt;
*** [[Shortest paths by repeated squaring]] (variant of Bellman-Ford) &lt;br /&gt;
** [[Single source shortest paths]]&lt;br /&gt;
*** [[Dijkstra]]&lt;br /&gt;
** [[Single source single target shortest paths]]&lt;br /&gt;
*** [[A*]] (Empty in old wiki)&lt;br /&gt;
* [[Maximum spanning forest]]&lt;br /&gt;
* [[Problems on Sequences]]&lt;br /&gt;
** [[Basic Problems on Sequences]]&lt;br /&gt;
*** [[Find an element in a sequence]] (DONE)&lt;br /&gt;
*** [[Insert an element in a sequence]] (Empty in old wiki?!)&lt;br /&gt;
*** [[Median]] (DONE)&lt;br /&gt;
*** [[Merging two sorted sequences]] (DONE)&lt;br /&gt;
** [[Pattern Matching]]&lt;br /&gt;
*** [[One-dimensional string matching]] (DONE)&lt;br /&gt;
*** [[String matching]] (DONE)&lt;br /&gt;
** [[Sorting]]&lt;br /&gt;
*** [[Sorting based on pairwise comparison]] (DONE)&lt;br /&gt;
*** [[Sorting Sequences of Strings]] (DONE)&lt;br /&gt;
&lt;br /&gt;
=== Coding Basics ===&lt;br /&gt;
* [[Inheritance]]&lt;br /&gt;
* [[Generics]]&lt;br /&gt;
* [[Collections]]&lt;br /&gt;
** [[Iterator]]&lt;br /&gt;
** [[Comparator]]&lt;br /&gt;
&lt;br /&gt;
=== String Matching Algorithms ===&lt;br /&gt;
* [[Simple string matching algorithm]] (DONE)&lt;br /&gt;
* [[String matching based on finite automaton]] (DONE)&lt;br /&gt;
&lt;br /&gt;
=== Sorting Algorithms ===&lt;br /&gt;
* [[Bubble]]&lt;br /&gt;
* [[Insertion sort]]&lt;br /&gt;
* [[Quicksort]]&lt;br /&gt;
* [[Bubblesort]]&lt;br /&gt;
* [[Mergesort]]&lt;br /&gt;
* [[Bucketsort]]&lt;br /&gt;
* [[Selection sort]]&lt;br /&gt;
* [[Bogosort]]&lt;br /&gt;
&lt;br /&gt;
=== Search Algorithms ===&lt;br /&gt;
* [[Binary search]]&lt;br /&gt;
&lt;br /&gt;
=== Auxillary Algorithms ===&lt;br /&gt;
* [[Pivot partitioning by scanning]]&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
* [[Array list: find]]&lt;br /&gt;
* [[Array list: find at position]]&lt;br /&gt;
* [[Array list: insert at head]]&lt;br /&gt;
* [[Array list: insert at position]]&lt;br /&gt;
* [[Array list: number]]&lt;br /&gt;
* [[Array list: remove]]&lt;br /&gt;
* [[Doubly-linked list: insert at position]]&lt;br /&gt;
* [[Doubly-linked list: insert at tail]]&lt;br /&gt;
* [[Doubly-linked list: remove]]&lt;br /&gt;
* [[Find element in sequence iteratively]]&lt;br /&gt;
* [[Find element in sequence recursively]]&lt;br /&gt;
* [[Hashtable: find]]&lt;br /&gt;
* [[Hashtable: insert]]&lt;br /&gt;
&lt;br /&gt;
=== Tree Algorithms ===&lt;br /&gt;
* [[Depth-first search]]&lt;br /&gt;
* [[Breadth-first search]]&lt;br /&gt;
* [[B-tree: find]]&lt;br /&gt;
* [[B-tree: minimum]]&lt;br /&gt;
* [[B-tree: maximum]]&lt;br /&gt;
* [[B-tree: insert]]&lt;br /&gt;
* [[B-tree: insert and rearrange]]&lt;br /&gt;
* [[B-tree: merge two siblings]]&lt;br /&gt;
* [[B-tree: remove]]&lt;br /&gt;
* [[B-tree: shift key to sibling]]&lt;br /&gt;
* [[B-tree: rotate]]&lt;br /&gt;
* [[B-tree: merge]]&lt;br /&gt;
* [[B-tree: split]]&lt;br /&gt;
* [[Binary search tree: find]]&lt;br /&gt;
* [[Binary search tree: minimum]]&lt;br /&gt;
* [[Binary search tree: maximum]]&lt;br /&gt;
* [[Binary search tree: insert]]&lt;br /&gt;
* [[Binary search tree: remove]]&lt;br /&gt;
* [[Binary search tree: remove node]]&lt;br /&gt;
* [[Binary search tree: traverse]]&lt;br /&gt;
&lt;br /&gt;
=== Graph Theory ===&lt;br /&gt;
* [[Directed graph]]&lt;br /&gt;
* [[Bipartite graph|Bipartite graph]] (DONE)&lt;br /&gt;
* [[k-partite graph]]&lt;br /&gt;
* [[Negative paths]]&lt;br /&gt;
&lt;br /&gt;
=== Graph Algorithms ===&lt;br /&gt;
* [[Dijkstra]]&lt;br /&gt;
* [[Kruskal]]&lt;br /&gt;
* [[Prim]]&lt;br /&gt;
* [[Bellman-Ford]] (DONE)&lt;br /&gt;
* [[Floyd-Warshall]]&lt;br /&gt;
* [[Union Find]]&lt;br /&gt;
* [[A*]]&lt;br /&gt;
* [[Alternating paths algorithm]]&lt;br /&gt;
* [[Johnson]]&lt;br /&gt;
* [[Union-find with disjoint trees: find]]&lt;br /&gt;
* [[Union-find with lists: unite]]&lt;br /&gt;
* [[Max-flow min-cut]]&lt;br /&gt;
&lt;br /&gt;
=== Flow Algorithms ===&lt;br /&gt;
* [[Ford-Fulkerson]]&lt;br /&gt;
* [[Edmonds-Karp]]&lt;br /&gt;
&lt;br /&gt;
=== Abstract Data Structures ===&lt;br /&gt;
*[[Network Structures]]&lt;br /&gt;
**[[Graph]]&lt;br /&gt;
**[[Tree]]&lt;br /&gt;
*[[Sequence]]&lt;br /&gt;
**[[Sorted sequence]]&lt;br /&gt;
**[[Bounded priority queue]]&lt;br /&gt;
**[[Linear sequence]]&lt;br /&gt;
**[[Priority queue]]&lt;br /&gt;
**[[Sorted sequence]]&lt;br /&gt;
=== Implementations of Abstract Data Structures  ===&lt;br /&gt;
* [[Linked list]]&lt;br /&gt;
* [[Array list]]&lt;br /&gt;
* [[Binary search tree]]&lt;br /&gt;
* [[Doubly-linked list]]&lt;br /&gt;
* [[Heap as array]] (DONE (Heap as Array))&lt;br /&gt;
* [[Hashtable]]&lt;br /&gt;
* [[Multi-way search tree]]&lt;br /&gt;
* [[Red-black tree]]&lt;br /&gt;
* [[B-tree]]&lt;br /&gt;
&lt;br /&gt;
=== ??? ===&lt;br /&gt;
* [[Min-Max Heaps]]&lt;br /&gt;
* [[First In - First Out]]&lt;br /&gt;
* [[First In - Last Out]]&lt;br /&gt;
* [[Directed Tree]]&lt;br /&gt;
* [[Decision Tree]]&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
* [[Model computer]]&lt;br /&gt;
&lt;br /&gt;
=== Other Algorithms (LOCKED) ===&lt;br /&gt;
* [[B*]]&lt;br /&gt;
* [[Cyclic redundancy check]]&lt;br /&gt;
* [[Euclid]]&lt;br /&gt;
* [[Gauss]]&lt;br /&gt;
* [[Discrete fourier transform]]&lt;br /&gt;
* [[Fast fourier transform]]&lt;br /&gt;
* [[Bresenham]]&lt;br /&gt;
* [[Round robin]]&lt;br /&gt;
* [[Seperate and conquer]]&lt;br /&gt;
* [[Message-Digest algorithm]]&lt;br /&gt;
* [[Secure hash algorithm]]&lt;br /&gt;
* [[Sequent calculus]]&lt;br /&gt;
* [[Resolution calculus]]&lt;br /&gt;
* [[Cocke-Younger-Kasami algorithm]]&lt;br /&gt;
* [[Distance vector routing]]&lt;br /&gt;
* [[Link state routing]]&lt;br /&gt;
* [[Z Buffer algorithm]]&lt;br /&gt;
* [[Marching squares]]&lt;br /&gt;
* [[Marching cubes]]&lt;br /&gt;
* [[Bottom-Up heapsort]]&lt;br /&gt;
* [[Radixsort]]&lt;br /&gt;
* [[Median cut]]&lt;br /&gt;
* [[Pancake sorting]]&lt;br /&gt;
* [[Karnaugh-Veitch diagramm]]&lt;br /&gt;
* [[Delanuay triangulation]]&lt;br /&gt;
* [[Backtracking]]&lt;br /&gt;
* [[Alpha–beta pruning]]&lt;br /&gt;
* [[Beam search]]&lt;br /&gt;
* [[Best-first search]]&lt;br /&gt;
* [[Bidirectional search]]&lt;br /&gt;
* [[Borůvka's algorithm]]&lt;br /&gt;
* [[Branch and bound]]&lt;br /&gt;
* [[D*]]&lt;br /&gt;
* [[Depth-limited search]]&lt;br /&gt;
* [[Edmonds' algorithm]]&lt;br /&gt;
* [[Fringe search]]&lt;br /&gt;
* [[Hill climbing]]&lt;br /&gt;
* [[IDA*]]&lt;br /&gt;
* [[Iterative deepening depth-first search]]&lt;br /&gt;
* [[Jump point search]]&lt;br /&gt;
* [[Lexicographic breadth-first search]]&lt;br /&gt;
* [[SMA*]]&lt;br /&gt;
* [[Uniform-cost search]]&lt;br /&gt;
&lt;br /&gt;
=== Other Data Structures (LOCKED) ===&lt;br /&gt;
* [[Adelson-Velskii and Landis' tree]]&lt;br /&gt;
* [[Patricia-Trie]]&lt;br /&gt;
* [[Suffix Tree]]&lt;br /&gt;
* [[Huffmann Tree]]&lt;br /&gt;
* [[Binary Expression Tree]]&lt;br /&gt;
* [[Hash Set]]&lt;br /&gt;
* [[Incidence Matrix]]&lt;br /&gt;
* [[Voronoi Diagramm]]&lt;br /&gt;
* [[Quad Tree]]&lt;br /&gt;
* [[Oct Tree]]&lt;br /&gt;
* [[kd Tree]]&lt;br /&gt;
* [[Binary space partitioning]]&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=468</id>
		<title>B-tree: shift key to sibling</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=468"/>
		<updated>2014-09-30T19:54:39Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[See B-tree]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# If &amp;lt;math&amp;gt; shiftRight&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \{&amp;lt;/math&amp;gt;, if &amp;lt;math&amp;gt;j&amp;gt;0&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \}&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{2, \dots ,i+1 \}&amp;lt;/math&amp;gt;, id &amp;lt;math&amp;gt;j \le n&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ 1, \dots ,i \}&amp;lt;/math&amp;gt;, the values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## A few moves have already been done (in the preprocessing, in fact):&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt; is now the node &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.children[k].keys[1]&amp;lt;/math&amp;gt; is now at &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The children pointers of &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]&amp;lt;/math are rearranged accordingly.&lt;br /&gt;
&lt;br /&gt;
'''Vairant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;(shiftRight&amp;lt;/math&amp;gt; &amp;amp;and;&amp;lt;math&amp;gt; i=p.children[k].n+1)&amp;lt;/math&amp;gt;&amp;amp;or;&amp;lt;math&amp;gt;(&amp;lt;/math&amp;gt;&amp;amp;not;&amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;&amp;amp;and;&amp;lt;math&amp;gt;i=p.children[k].n)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Move the next key and children pointer.&lt;br /&gt;
# If &amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt; and the break condition applies, the shift is to be done.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# If &amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If &amp;lt;math&amp;gt;i \le n&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;p.children[k]keys[p.children[k].n-i+2]:= p.children[k],keys[p.children[k]._n-i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p.children[k].children[p.children[k]._n-i+2]:= p.children[k].children[p.children[k]_n-i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt; i=n+1&amp;lt;/math&amp;gt;:&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p.children[k].keys[1]:= p.keys[k]&amp;lt;/math&amp;gt;&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p.keys[k]:=p.children[k-1].keys[p.children[k-1]_n] &amp;lt;/math&amp;gt;&lt;br /&gt;
### Increment &amp;lt;math&amp;gt;p.children[k]_n by one &amp;lt;/math&amp;gt;&lt;br /&gt;
### Decrement &amp;lt;math&amp;gt;p.children[j-1]_n by one&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## If &amp;lt;math&amp;gt;i&amp;lt;p.children[k]_n&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p.children[k].keys[i]:= p.children[k].keys[i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p.children[k].children[i-1]:= p.children[k].children[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;i=p.children[k]_n, &amp;lt;/math&amp;gt;decrement &amp;lt;math&amp;gt;p.children[k]_n&amp;lt;/math&amp;gt; by one&lt;br /&gt;
&lt;br /&gt;
'''Correctness:'''&lt;br /&gt;
# For the rearrangement of the children pointers, compare the induction basis.&lt;br /&gt;
# Note that the increments and decrements of &amp;lt;math&amp;gt;p.children[k-1]_n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]_n &amp;lt;/math&amp;gt; are distributed over induction basis and induction step, but are correct in summary.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' Linear in &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; in the best and worst case (and hence constant for fixed &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;).&lt;br /&gt;
'''Proof:''' Obvious.&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=467</id>
		<title>B-tree: shift key to sibling</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=467"/>
		<updated>2014-09-30T19:54:08Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[See B-tree]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# If &amp;lt;math&amp;gt; shiftRight&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \{&amp;lt;/math&amp;gt;, if &amp;lt;math&amp;gt;j&amp;gt;0&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \}&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{2, \dots ,i+1 \}&amp;lt;/math&amp;gt;, id &amp;lt;math&amp;gt;j \le n&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ 1, \dots ,i \}&amp;lt;/math&amp;gt;, the values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## A few moves have already been done (in the preprocessing, in fact):&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt; is now the node &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.children[k].keys[1]&amp;lt;/math&amp;gt; is now at &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The children pointers of &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]&amp;lt;/math are rearranged accordingly.&lt;br /&gt;
&lt;br /&gt;
'''Vairant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;(shiftRight&amp;lt;/math&amp;gt; &amp;amp;and;&amp;lt;math&amp;gt; i=p.children[k].n+1)&amp;lt;/math&amp;gt;&amp;amp;or;&amp;lt;math&amp;gt;(&amp;lt;/math&amp;gt;&amp;amp;not;&amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;&amp;amp;and;&amp;lt;math&amp;gt;i=p.children[k].n)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Move the next key and children pointer.&lt;br /&gt;
# If &amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt; and the break condition applies, the shift is to be done.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# If &amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If &amp;lt;math&amp;gt;i \le n&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;p.children[k]keys[p.children[k].n-i+2]:= p.children[k],keys[p.children[k]._n-i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p.children[k].children[p.children[k]._n-i+2]:= p.children[k].children[p.children[k]_n-i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt; i=n+1&amp;lt;/math&amp;gt;:&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p.children[k].keys[1]:= p.keys[k]&amp;lt;/math&amp;gt;&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p.keys[k]:=p.children[k-1].keys[p.children[k-1]_n]&lt;br /&gt;
### Increment &amp;lt;math&amp;gt;p.children[k]_n by one&lt;br /&gt;
### Decrement &amp;lt;math&amp;gt;p.children[j-1]_n by one&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## If &amp;lt;math&amp;gt;i&amp;lt;p.children[k]_n&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p.children[k].keys[i]:= p.children[k].keys[i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p.children[k].children[i-1]:= p.children[k].children[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;i=p.children[k]_n, &amp;lt;/math&amp;gt;decrement &amp;lt;math&amp;gt;p.children[k]_n&amp;lt;/math&amp;gt; by one&lt;br /&gt;
&lt;br /&gt;
'''Correctness:'''&lt;br /&gt;
# For the rearrangement of the children pointers, compare the induction basis.&lt;br /&gt;
# Note that the increments and decrements of &amp;lt;math&amp;gt;p.children[k-1]_n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]_n &amp;lt;/math&amp;gt; are distributed over induction basis and induction step, but are correct in summary.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' Linear in &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; in the best and worst case (and hence constant for fixed &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;).&lt;br /&gt;
'''Proof:''' Obvious.&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=466</id>
		<title>B-tree: shift key to sibling</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=466"/>
		<updated>2014-09-30T19:49:58Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Complexity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[See B-tree]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# If &amp;lt;math&amp;gt; shiftRight&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \{&amp;lt;/math&amp;gt;, if &amp;lt;math&amp;gt;j&amp;gt;0&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \}&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{2, \dots ,i+1 \}&amp;lt;/math&amp;gt;, id &amp;lt;math&amp;gt;j \le n&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ 1, \dots ,i \}&amp;lt;/math&amp;gt;, the values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## A few moves have already been done (in the preprocessing, in fact):&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt; is now the node &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.children[k].keys[1]&amp;lt;/math&amp;gt; is now at &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The children pointers of &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]&amp;lt;/math are rearranged accordingly.&lt;br /&gt;
&lt;br /&gt;
'''Vairant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;(shiftRight&amp;lt;/math&amp;gt; &amp;amp;and;&amp;lt;math&amp;gt; i=p.children[k].n+1)&amp;lt;/math&amp;gt;&amp;amp;or;&amp;lt;math&amp;gt;(&amp;lt;/math&amp;gt;&amp;amp;not;&amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;&amp;amp;and;&amp;lt;math&amp;gt;i=p.children[k].n)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Move the next key and children pointer.&lt;br /&gt;
# If &amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt; and the break condition applies, the shift is to be done.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# If &amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If &amp;lt;math&amp;gt;i \le n&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;p.children[k]keys[p.children[k].n-i+2]:= p.children[k],keys[p.children[k]._n_-i_+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p.children[k].children[p.children[k]._n-i+2]:= p.children[k].children[p.children[k]._n-i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt; i=n+1&amp;lt;/math&amp;gt;:&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p.children[k].keys[1]:= p.keys[k]&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p.keys[k]:=p.children[k-1].keys[p.children[k-1]_n]&lt;br /&gt;
### Increment &amp;lt;math&amp;gt;p.children[k]_n by one&lt;br /&gt;
### Decrement &amp;lt;math&amp;gt;p.children[j-1]_n by one&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## If &amp;lt;math&amp;gt;i&amp;lt;p.children[k]_n&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p.children[k].keys[i]:= p.children[k].keys[i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p.children[k].children[i-1]:= p.children[k].children[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;i=p.children[k]_n, &amp;lt;/math&amp;gt;decrement &amp;lt;math&amp;gt;p.children[k]_n&amp;lt;/math&amp;gt; by one&lt;br /&gt;
&lt;br /&gt;
'''Correctness:'''&lt;br /&gt;
# For the rearrangement of the children pointers, compare the induction basis.&lt;br /&gt;
# Note that the increments and decrements of &amp;lt;math&amp;gt;p.children[k-1]_n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]_n &amp;lt;/math&amp;gt; are distributed over induction basis and induction step, but are correct in summary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' Linear in &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; in the best and worst case (and hence constant for fixed &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;).&lt;br /&gt;
'''Proof:''' Obvious.&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=465</id>
		<title>B-tree: shift key to sibling</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=465"/>
		<updated>2014-09-30T19:48:53Z</updated>

		<summary type="html">&lt;p&gt;Lkw: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[See B-tree]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# If &amp;lt;math&amp;gt; shiftRight&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \{&amp;lt;/math&amp;gt;, if &amp;lt;math&amp;gt;j&amp;gt;0&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \}&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{2, \dots ,i+1 \}&amp;lt;/math&amp;gt;, id &amp;lt;math&amp;gt;j \le n&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ 1, \dots ,i \}&amp;lt;/math&amp;gt;, the values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## A few moves have already been done (in the preprocessing, in fact):&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt; is now the node &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.children[k].keys[1]&amp;lt;/math&amp;gt; is now at &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The children pointers of &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]&amp;lt;/math are rearranged accordingly.&lt;br /&gt;
&lt;br /&gt;
'''Vairant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;(shiftRight&amp;lt;/math&amp;gt; &amp;amp;and;&amp;lt;math&amp;gt; i=p.children[k].n+1)&amp;lt;/math&amp;gt;&amp;amp;or;&amp;lt;math&amp;gt;(&amp;lt;/math&amp;gt;&amp;amp;not;&amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;&amp;amp;and;&amp;lt;math&amp;gt;i=p.children[k].n)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Move the next key and children pointer.&lt;br /&gt;
# If &amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt; and the break condition applies, the shift is to be done.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# If &amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If &amp;lt;math&amp;gt;i \le n&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;p.children[k]keys[p.children[k].n-i+2]:= p.children[k],keys[p.children[k]._n_-i_+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p.children[k].children[p.children[k]._n-i+2]:= p.children[k].children[p.children[k]._n-i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt; i=n+1&amp;lt;/math&amp;gt;:&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p.children[k].keys[1]:= p.keys[k]&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p.keys[k]:=p.children[k-1].keys[p.children[k-1]_n]&lt;br /&gt;
### Increment &amp;lt;math&amp;gt;p.children[k]_n by one&lt;br /&gt;
### Decrement &amp;lt;math&amp;gt;p.children[j-1]_n by one&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## If &amp;lt;math&amp;gt;i&amp;lt;p.children[k]_n&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p.children[k].keys[i]:= p.children[k].keys[i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p.children[k].children[i-1]:= p.children[k].children[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;i=p.children[k]_n, &amp;lt;/math&amp;gt;decrement &amp;lt;math&amp;gt;p.children[k]_n&amp;lt;/math&amp;gt; by one&lt;br /&gt;
&lt;br /&gt;
'''Correctness:'''&lt;br /&gt;
# For the rearrangement of the children pointers, compare the induction basis.&lt;br /&gt;
# Note that the increments and decrements of &amp;lt;math&amp;gt;p.children[k-1]_n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]_n &amp;lt;/math&amp;gt; are distributed over induction basis and induction step, but are correct in summary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=464</id>
		<title>B-tree: shift key to sibling</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=464"/>
		<updated>2014-09-30T19:47:20Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction Basis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[See B-tree]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# If &amp;lt;math&amp;gt; shiftRight&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \{&amp;lt;/math&amp;gt;, if &amp;lt;math&amp;gt;j&amp;gt;0&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \}&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{2, \dots ,i+1 \}&amp;lt;/math&amp;gt;, id &amp;lt;math&amp;gt;j \le n&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ 1, \dots ,i \}&amp;lt;/math&amp;gt;, the values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## A few moves have already been done (in the preprocessing, in fact):&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt; is now the node &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.children[k].keys[1]&amp;lt;/math&amp;gt; is now at &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The children pointers of &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]&amp;lt;/math are rearranged accordingly.&lt;br /&gt;
&lt;br /&gt;
'''Vairant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;(shiftRight&amp;lt;/math&amp;gt; &amp;amp;and;&amp;lt;math&amp;gt; i=p.children[k].n+1)&amp;lt;/math&amp;gt;&amp;amp;or;&amp;lt;math&amp;gt;(&amp;lt;/math&amp;gt;&amp;amp;not;&amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;&amp;amp;and;&amp;lt;math&amp;gt;i=p.children[k].n)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Move the next key and children pointer.&lt;br /&gt;
# If &amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt; and the break condition applies, the shift is to be done.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# If &amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If &amp;lt;math&amp;gt;i \le n&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;p.children[k]keys[p.children[k].n-i+2]:= p.children[k],keys[p.children[k]._n_-i_+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p.children[k].children[p.children[k]._n-i+2]:= p.children[k].children[p.children[k]._n-i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt; i=n+1&amp;lt;/math&amp;gt;:&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p.children[k].keys[1]:= p.keys[k]&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p.keys[k]:=p.children[k-1].keys[p.children[k-1]_n]&lt;br /&gt;
### Increment &amp;lt;math&amp;gt;p.children[k]_n by one&lt;br /&gt;
### Decrement &amp;lt;math&amp;gt;p.children[j-1]_n by one&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## If &amp;lt;math&amp;gt;i&amp;lt;p.children[k]_n&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p.children[k].keys[i]:= p.children[k].keys[i+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p.children[k].children[i-1]:= p.children[k].children[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;i=p.children[k]_n, &amp;lt;/math&amp;gt;decrement &amp;lt;math&amp;gt;p.children[k]_n&amp;lt;/math&amp;gt; by one&lt;br /&gt;
&lt;br /&gt;
'''Correctness:'''&lt;br /&gt;
# For the rearrangement of the children pointers, compare the induction basis.&lt;br /&gt;
# Note that the increments and decrements of &amp;lt;math&amp;gt;p.children[k-1]_n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]_n &amp;lt;/math&amp;gt; are distributed over induction basis and induction step, but are correct in summary.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p.keys[1], \dots , p.keys[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p. successor[j-1]:= p.successors[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Easy to see.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=463</id>
		<title>B-tree: shift key to sibling</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_shift_key_to_sibling&amp;diff=463"/>
		<updated>2014-09-30T19:27:01Z</updated>

		<summary type="html">&lt;p&gt;Lkw: Created page with &amp;quot;Category:B-Tree Category:Algorithm == General Information == '''Algorithmic problem:''' See B-tree  '''Type of algorithm:''' loop  '''Auxiliary data:'''   == Abstr...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[See B-tree]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# If &amp;lt;math&amp;gt; shiftRight&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \{&amp;lt;/math&amp;gt;, if &amp;lt;math&amp;gt;j&amp;gt;0&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ p.children[k].n-i+1, \dots ,p.children[k].n \}&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{2, \dots ,i+1 \}&amp;lt;/math&amp;gt;, id &amp;lt;math&amp;gt;j \le n&amp;lt;/math&amp;gt;, the original values of &amp;lt;math&amp;gt;p.children[k].key[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].key[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt;j \in \{ 1, \dots ,i \}&amp;lt;/math&amp;gt;, the values of &amp;lt;math&amp;gt;p.children[k].children[j]&amp;lt;/math&amp;gt; are now the values of &amp;lt;math&amp;gt;p.children[k].children[j-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## A few moves have already been done (in the preprocessing, in fact):&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt; is now the node &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The former value of &amp;lt;math&amp;gt;p.children[k].keys[1]&amp;lt;/math&amp;gt; is now at &amp;lt;math&amp;gt;p.keys[k]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### The children pointers of &amp;lt;math&amp;gt;p.children[k-1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k]&amp;lt;/math are rearranged accordingly.&lt;br /&gt;
&lt;br /&gt;
'''Vairant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;(shiftRight&amp;lt;/math&amp;gt; &amp;amp;and;&amp;lt;math&amp;gt; i=p.children[k].n+1)&amp;lt;/math&amp;gt;&amp;amp;or;&amp;lt;math&amp;gt;(&amp;lt;/math&amp;gt;&amp;amp;not;&amp;lt;math&amp;gt;shiftRight&amp;lt;/math&amp;gt;&amp;amp;and;&amp;lt;math&amp;gt;i=p.children[k].n)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p.keys[1], \dots , p.keys[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p. successor[j-1]:= p.successors[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Easy to see.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=452</id>
		<title>B-tree: merge two siblings</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=452"/>
		<updated>2014-09-30T17:45:07Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Complexity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' See B-Tree&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' &lt;br /&gt;
# A node &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; with a key at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; that is not void&lt;br /&gt;
# The number of keys in &amp;lt;math&amp;gt;p.children[k-1]=p.children[k]=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; of type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt; i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# &amp;lt;math&amp;gt; p_1&amp;lt;/math&amp;gt; points to the left children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; points to the right children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1.n = M+i&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; shows on the index of the copied key in &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Assign &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; the left children of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; the right children of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Move the key from &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Copy the left children of &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; to the new key in &amp;lt;math&amp;gt;p1&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;&lt;br /&gt;
# Change the number of keys in &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1 := p.children[k-1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2 := p.children[k]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k] := void&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1.keys[M] := p.keys[k]&amp;lt;/math&amp;gt; and for &amp;lt;math&amp;gt;j \in k+1, \dots , p.n&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt;p.keys[j-1] := p.keys[j]&amp;lt;/math&amp;gt; &lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1.children[M] := p_2.children[0]&amp;lt;/math&amp;gt;&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1.n := p_1.n+1&amp;lt;/math&amp;gt; and set &amp;lt;math&amp;gt;p.n := p.n-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' In the induction basic &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are assigned to the left and the right children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; (Invariant 1). The key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is shifted to &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;. So the elements &amp;lt;math&amp;gt;1 \dots , M&amp;lt;/math&amp;gt; are filled (B-Tree #5). The number of elements in &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; is increased by one and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is decreased by one (B-Tree #3). So are in &amp;lt;math&amp;gt;p_1 M&amp;lt;/math&amp;gt; keys (Invariant 2). We removed a key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, but because of the invariant of remove (&amp;lt;math&amp;gt;minM&amp;lt;/math&amp;gt; keys in &amp;lt;math&amp;gt;&amp;lt;/math&amp;gt;), now we have &amp;lt;math&amp;gt;minM - 1&amp;lt;/math&amp;gt; keys in &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; (B-Tree #4). We added the key from &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; to the left children (all keys in this children are smaller) on the right side, so the sorting order is correct again (B-Tree #6). The copied children comes from the right children, so all keys in this children are bigger again (B-Tree #7). The copied children come from the same level (&amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are both children of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;), so all leaves are on the same level again (B-Tree #8). In the induction basic is no key copied from &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; (Invariant 3).&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If not all keys (and children) of &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are copied, copy the key and children from position &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; to position &amp;lt;math&amp;gt;M+i&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, terminate the algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# if &amp;lt;math&amp;gt;i \le M-1&amp;lt;/math&amp;gt; (that is, not all keys of &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are copied):&lt;br /&gt;
## &amp;lt;math&amp;gt;p_1.keys[M+i] := p_2.keys[i].&amp;lt;/math&amp;gt;&lt;br /&gt;
## &amp;lt;math&amp;gt;p_1.children[M+i] := p_2.children[i].&amp;lt;/math&amp;gt;&lt;br /&gt;
## &amp;lt;math&amp;gt;p_1.n := p_1.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise, terminate the algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' In the induction step we copy a key and a children from &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt;. The copy is in the same order as the elements and on the same level. Implementation invariants #1, #2, #4, #6, #7 and #8 are trivially fulfilled. In step 1.3 we increase &amp;lt;math&amp;gt;p_1.n&amp;lt;/math&amp;gt; by one for each copied element (B-Tree #3).&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' Linear in &amp;lt;math&amp;gt;M-1&amp;lt;/math&amp;gt; steps in the best and worst case&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Obvious.&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=451</id>
		<title>B-tree: merge two siblings</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=451"/>
		<updated>2014-09-30T17:44:20Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction Step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' See B-Tree&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' &lt;br /&gt;
# A node &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; with a key at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; that is not void&lt;br /&gt;
# The number of keys in &amp;lt;math&amp;gt;p.children[k-1]=p.children[k]=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; of type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt; i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# &amp;lt;math&amp;gt; p_1&amp;lt;/math&amp;gt; points to the left children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; points to the right children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1.n = M+i&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; shows on the index of the copied key in &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Assign &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; the left children of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; the right children of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Move the key from &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Copy the left children of &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; to the new key in &amp;lt;math&amp;gt;p1&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;&lt;br /&gt;
# Change the number of keys in &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1 := p.children[k-1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2 := p.children[k]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k] := void&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1.keys[M] := p.keys[k]&amp;lt;/math&amp;gt; and for &amp;lt;math&amp;gt;j \in k+1, \dots , p.n&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt;p.keys[j-1] := p.keys[j]&amp;lt;/math&amp;gt; &lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1.children[M] := p_2.children[0]&amp;lt;/math&amp;gt;&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1.n := p_1.n+1&amp;lt;/math&amp;gt; and set &amp;lt;math&amp;gt;p.n := p.n-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' In the induction basic &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are assigned to the left and the right children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; (Invariant 1). The key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is shifted to &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;. So the elements &amp;lt;math&amp;gt;1 \dots , M&amp;lt;/math&amp;gt; are filled (B-Tree #5). The number of elements in &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; is increased by one and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is decreased by one (B-Tree #3). So are in &amp;lt;math&amp;gt;p_1 M&amp;lt;/math&amp;gt; keys (Invariant 2). We removed a key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, but because of the invariant of remove (&amp;lt;math&amp;gt;minM&amp;lt;/math&amp;gt; keys in &amp;lt;math&amp;gt;&amp;lt;/math&amp;gt;), now we have &amp;lt;math&amp;gt;minM - 1&amp;lt;/math&amp;gt; keys in &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; (B-Tree #4). We added the key from &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; to the left children (all keys in this children are smaller) on the right side, so the sorting order is correct again (B-Tree #6). The copied children comes from the right children, so all keys in this children are bigger again (B-Tree #7). The copied children come from the same level (&amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are both children of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;), so all leaves are on the same level again (B-Tree #8). In the induction basic is no key copied from &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; (Invariant 3).&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If not all keys (and children) of &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are copied, copy the key and children from position &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; to position &amp;lt;math&amp;gt;M+i&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, terminate the algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# if &amp;lt;math&amp;gt;i \le M-1&amp;lt;/math&amp;gt; (that is, not all keys of &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are copied):&lt;br /&gt;
## &amp;lt;math&amp;gt;p_1.keys[M+i] := p_2.keys[i].&amp;lt;/math&amp;gt;&lt;br /&gt;
## &amp;lt;math&amp;gt;p_1.children[M+i] := p_2.children[i].&amp;lt;/math&amp;gt;&lt;br /&gt;
## &amp;lt;math&amp;gt;p_1.n := p_1.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise, terminate the algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' In the induction step we copy a key and a children from &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt;. The copy is in the same order as the elements and on the same level. Implementation invariants #1, #2, #4, #6, #7 and #8 are trivially fulfilled. In step 1.3 we increase &amp;lt;math&amp;gt;p_1.n&amp;lt;/math&amp;gt; by one for each copied element (B-Tree #3).&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=445</id>
		<title>B-tree: merge two siblings</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=445"/>
		<updated>2014-09-30T17:38:42Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction Basis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' See B-Tree&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' &lt;br /&gt;
# A node &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; with a key at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; that is not void&lt;br /&gt;
# The number of keys in &amp;lt;math&amp;gt;p.children[k-1]=p.children[k]=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; of type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt; i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# &amp;lt;math&amp;gt; p_1&amp;lt;/math&amp;gt; points to the left children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; points to the right children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1.n = M+i&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; shows on the index of the copied key in &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Assign &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; the left children of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; the right children of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Move the key from &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Copy the left children of &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; to the new key in &amp;lt;math&amp;gt;p1&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;&lt;br /&gt;
# Change the number of keys in &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1 := p.children[k-1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2 := p.children[k]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p.children[k] := void&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1.keys[M] := p.keys[k]&amp;lt;/math&amp;gt; and for &amp;lt;math&amp;gt;j \in k+1, \dots , p.n&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt;p.keys[j-1] := p.keys[j]&amp;lt;/math&amp;gt; &lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1.children[M] := p_2.children[0]&amp;lt;/math&amp;gt;&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p_1.n := p_1.n+1&amp;lt;/math&amp;gt; and set &amp;lt;math&amp;gt;p.n := p.n-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' In the induction basic &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are assigned to the left and the right children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; (Invariant 1). The key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is shifted to &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;. So the elements &amp;lt;math&amp;gt;1 \dots , M&amp;lt;/math&amp;gt; are filled (B-Tree #5). The number of elements in &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; is increased by one and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is decreased by one (B-Tree #3). So are in &amp;lt;math&amp;gt;p_1 M&amp;lt;/math&amp;gt; keys (Invariant 2). We removed a key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, but because of the invariant of remove (&amp;lt;math&amp;gt;minM&amp;lt;/math&amp;gt; keys in &amp;lt;math&amp;gt;&amp;lt;/math&amp;gt;), now we have &amp;lt;math&amp;gt;minM - 1&amp;lt;/math&amp;gt; keys in &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; (B-Tree #4). We added the key from &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; to the left children (all keys in this children are smaller) on the right side, so the sorting order is correct again (B-Tree #6). The copied children comes from the right children, so all keys in this children are bigger again (B-Tree #7). The copied children come from the same level (&amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are both children of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;), so all leaves are on the same level again (B-Tree #8). In the induction basic is no key copied from &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; (Invariant 3).&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p.keys[1], \dots , p.keys[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p. successor[j-1]:= p.successors[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Easy to see.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=441</id>
		<title>B-tree: merge two siblings</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=441"/>
		<updated>2014-09-30T17:25:07Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Abstract View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' See B-Tree&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' &lt;br /&gt;
# A node &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; with a key at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; that is not void&lt;br /&gt;
# The number of keys in &amp;lt;math&amp;gt;p.children[k-1]=p.children[k]=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; of type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt; i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# &amp;lt;math&amp;gt; p_1&amp;lt;/math&amp;gt; points to the left children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; points to the right children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1.n = M+i&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; shows on the index of the copied key in &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p.keys[1], \dots , p.keys[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p. successor[j-1]:= p.successors[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Easy to see.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=440</id>
		<title>B-tree: merge two siblings</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=440"/>
		<updated>2014-09-30T17:24:42Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* General Information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' See B-Tree&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' &lt;br /&gt;
# A node &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; with a key at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; that is not void&lt;br /&gt;
# The number of keys in &amp;lt;math&amp;gt;p.children[k-1]=p.children[k]=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; of type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt; i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# &amp;lt;math&amp;gt; p_1&amp;lt;/math&amp;gt; points to the left children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; points to the right children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1.n = M+i&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; shows on the index of the copied key in &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p.keys[1], \dots , p.keys[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p. successor[j-1]:= p.successors[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Easy to see.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=439</id>
		<title>B-tree: merge two siblings</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_merge_two_siblings&amp;diff=439"/>
		<updated>2014-09-30T17:24:11Z</updated>

		<summary type="html">&lt;p&gt;Lkw: Created page with &amp;quot;Category:B-Tree Category:Algorithm == General Information == '''Algorithmic problem:''' See B-Tree  '''Prerequisites:'''  # A node &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; with a key at positio...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' See B-Tree&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' &lt;br /&gt;
# A node &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; with a key at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; that is not void&lt;br /&gt;
# The number of keys in &amp;lt;math&amp;gt;p.children[k-1]=p.children[k]=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; of type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt; i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
# &amp;lt;math&amp;gt; p_1&amp;lt;/math&amp;gt; points to the left children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; points to the right children of the key of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; at position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1.n = M+i&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; shows on the index of the copied key in &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i=M-1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p.keys[1], \dots , p.keys[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p. successor[j-1]:= p.successors[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Easy to see.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=435</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=435"/>
		<updated>2014-09-30T17:18:06Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* General Information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; of type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p.keys[1], \dots , p.keys[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p. successor[j-1]:= p.successors[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Easy to see.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=432</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=432"/>
		<updated>2014-09-30T17:07:53Z</updated>

		<summary type="html">&lt;p&gt;Lkw: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; or type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p.keys[1], \dots , p.keys[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p. successor[j-1]:= p.successors[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Easy to see.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=431</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=431"/>
		<updated>2014-09-30T17:07:04Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction Step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; or type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p.keys[1], ... , p.keys[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p.keys[1], \dots , p.keys[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p. successor[j-1]:= p.successors[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Follows immediately from the fact that the height of B-tree with '''''n''''' nodes is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; (cf. the remark clause of the [[B-Trees]] page).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=430</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=430"/>
		<updated>2014-09-30T17:05:24Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction Step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; or type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys&amp;lt;math&amp;gt;[1], ... , p.&amp;lt;/math&amp;gt;keys&amp;lt;math&amp;gt;[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys&amp;lt;math&amp;gt;[1], ... , p&amp;lt;/math&amp;gt;.keys &amp;lt;math&amp;gt;[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p&amp;lt;/math&amp;gt;.keys&amp;lt;math&amp;gt;[1], \dots , p&amp;lt;/math&amp;gt;.keys &amp;lt;math&amp;gt;[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p. successor[j-1]:= p.successors[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Follows immediately from the fact that the height of B-tree with '''''n''''' nodes is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; (cf. the remark clause of the [[B-Trees]] page).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=429</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=429"/>
		<updated>2014-09-30T17:04:28Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction Step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; or type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys&amp;lt;math&amp;gt;[1], ... , p.&amp;lt;/math&amp;gt;keys&amp;lt;math&amp;gt;[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys&amp;lt;math&amp;gt;[1], ... , p&amp;lt;/math&amp;gt;.keys &amp;lt;math&amp;gt;[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p&amp;lt;/math&amp;gt;.keys&amp;lt;math&amp;gt;[1], \dots , p&amp;lt;/math&amp;gt;.keys &amp;lt;math&amp;gt;[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; successor&amp;lt;math&amp;gt;[j-1]:= p.&amp;lt;/math&amp;gt;successors&amp;lt;math&amp;gt;[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} &amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Follows immediately from the fact that the height of B-tree with '''''n''''' nodes is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; (cf. the remark clause of the [[B-Trees]] page).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=428</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=428"/>
		<updated>2014-09-30T17:03:04Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction Step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; or type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of { &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys&amp;lt;math&amp;gt;[1], ... , p.&amp;lt;/math&amp;gt;keys&amp;lt;math&amp;gt;[p.n], K'&amp;lt;/math&amp;gt; }&lt;br /&gt;
## Analogously, &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt; will contain all keys strictly greater than the median of { &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys&amp;lt;math&amp;gt;[1], ... , p&amp;lt;/math&amp;gt;.keys &amp;lt;math&amp;gt;[p.n], K'&amp;lt;/math&amp;gt; }.&lt;br /&gt;
## Next we try to&lt;br /&gt;
## If &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; is that median itself, nothing is to be done on the current node.&lt;br /&gt;
## Otherwise, the median of &amp;lt;math&amp;gt;\{p&amp;lt;/math&amp;gt;.keys&amp;lt;math&amp;gt;[1], \dots , p&amp;lt;/math&amp;gt;.keys &amp;lt;math&amp;gt;[p.n], K'\}&amp;lt;/math&amp;gt;  is in one of the slots of the node. This slot is overridden (by moving the contents of each slot to the right one position further left). The previous contents of this slot is the new &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; . If the current node is the root, which we next try to insert in the predecessor of&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;&lt;br /&gt;
## If &amp;lt;math&amp;gt;p.keys[M] &amp;lt; K' &amp;lt; p.keys[M + 1]&amp;lt;/math&amp;gt;, break the iteration and continue the loop.&lt;br /&gt;
## Otherwise: &amp;lt;math&amp;gt; x:= M&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt; K' &amp;lt; p.keys[M]&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt; x:= M+1&amp;lt;/math&amp;gt; otherwise.&lt;br /&gt;
## Set &amp;lt;math&amp;gt; K'' := p.keys[x]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{x+1, \dots, p.n \}&amp;lt;/math&amp;gt; (in this order), set &amp;lt;math&amp;gt; p.keys [j-1]:= p.keys[j] &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; successor&amp;lt;math&amp;gt;[j-1]:= p.&amp;lt;/math&amp;gt;successors&amp;lt;math&amp;gt;[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.keys[p.n] &amp;lt; K'&amp;lt;/math&amp;gt;, insert the new (key, value)-pair at position &amp;lt;math&amp;gt;p.keys[p.n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Let &amp;lt;math&amp;gt;i \in \{ 1, \dots , p.n \} &amp;lt;/math&amp;gt; be minimal subject to &amp;lt;math&amp;gt;K' &amp;lt; p.keys[i]&amp;lt;/math&amp;gt;&lt;br /&gt;
## For &amp;lt;math&amp;gt; j \in \{ p.n, \dots , i \} (in this order), set &amp;lt;math&amp;gt; p.keys[j+1]:= p.keys[j]. &amp;lt;/math&amp;gt;&lt;br /&gt;
# If &amp;lt;math&amp;gt; p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt; p.n:= p.n+1&amp;lt;/math&amp;gt; and terminate the algorithm.&lt;br /&gt;
# Otherwise, set &amp;lt;math&amp;gt;K':= K''&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
# If '''''K''''' is one of the values &amp;lt;math&amp;gt;p.keys[1],\dots,p.keys[p.n]&amp;lt;/math&amp;gt;, terminate the algorithm and return '''''true'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.children[0] = void&amp;lt;/math&amp;gt; (that is, the current node is a leaf), terminate the algorithm and return '''''false'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;K &amp;lt; p.keys[1]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if &amp;lt;math&amp;gt;K &amp;gt; p.keys[p.n]&amp;lt;/math set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, there is exactly one &amp;lt;math&amp;gt;i \in \{1,\dots,p.n-1\}&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;p.keys[i] &amp;lt; K &amp;lt; p.keys[i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p := p.children[i]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Follows immediately from the fact that the height of B-tree with '''''n''''' nodes is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; (cf. the remark clause of the [[B-Trees]] page).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=424</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=424"/>
		<updated>2014-09-30T16:31:42Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction Step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; or type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the node is not full, the key can be inserted, and we are done.&lt;br /&gt;
## If the new key is larger than all keys stored in the node, it can be appended.&lt;br /&gt;
## Otherwise, is must override one specific slot. For that, first the contents of this slot and of each slot to its right must be moved one position further right (the corresponding values and successor pointers have to be moved as well). Then the new (key,value)-pair may be safely inserted.&lt;br /&gt;
# On the other hand, if the node is indeed full, the key cannot be inserted. In this case:&lt;br /&gt;
## The current node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; will be split into two nodes, &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
## &amp;lt;math&amp;gt;N_1&amp;lt;/math&amp;gt;  will contain all keys strictly less than the median of &amp;lt;math&amp;gt;{p&amp;lt;/math&amp;gt;.keys&amp;lt;math&amp;gt;[1], ... , p.&amp;lt;/math&amp;gt;keys&amp;lt;math&amp;gt;[p.n], K'} &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If '''''K''''' is one of the values &amp;lt;math&amp;gt;p.keys[1],\dots,p.keys[p.n]&amp;lt;/math&amp;gt;, terminate the algorithm and return '''''true'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.children[0] = void&amp;lt;/math&amp;gt; (that is, the current node is a leaf), terminate the algorithm and return '''''false'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;K &amp;lt; p.keys[1]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if &amp;lt;math&amp;gt;K &amp;gt; p.keys[p.n]&amp;lt;/math set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, there is exactly one &amp;lt;math&amp;gt;i \in \{1,\dots,p.n-1\}&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;p.keys[i] &amp;lt; K &amp;lt; p.keys[i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p := p.children[i]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Follows immediately from the fact that the height of B-tree with '''''n''''' nodes is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; (cf. the remark clause of the [[B-Trees]] page).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=423</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=423"/>
		<updated>2014-09-30T16:25:22Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Induction Basis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; or type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is set to the input pointer.&lt;br /&gt;
# &amp;lt;math&amp;gt;p_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p_2&amp;lt;/math&amp;gt; are void initially.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The requirement on the input pointer immediately implies the invariants.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# Let '''''N''''' denote the node to which '''''p''''' currently points.&lt;br /&gt;
# If the searched key is in '''''N''''', terminate the algorithm and return '''''true'''''.&lt;br /&gt;
# Otherwise, if '''''N''''' is a leaf, terminate the algorithm and return '''''false'''''.&lt;br /&gt;
# Otherwise, let '''''p''''' point the child of '''''N''''' such that the searched key is in the [[Directed Tree#Ranges of Search Tree Nodes|range]] of that child&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If '''''K''''' is one of the values &amp;lt;math&amp;gt;p.keys[1],\dots,p.keys[p.n]&amp;lt;/math&amp;gt;, terminate the algorithm and return '''''true'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.children[0] = void&amp;lt;/math&amp;gt; (that is, the current node is a leaf), terminate the algorithm and return '''''false'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;K &amp;lt; p.keys[1]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if &amp;lt;math&amp;gt;K &amp;gt; p.keys[p.n]&amp;lt;/math set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, there is exactly one &amp;lt;math&amp;gt;i \in \{1,\dots,p.n-1\}&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;p.keys[i] &amp;lt; K &amp;lt; p.keys[i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p := p.children[i]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Follows immediately from the fact that the height of B-tree with '''''n''''' nodes is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; (cf. the remark clause of the [[B-Trees]] page).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=422</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=422"/>
		<updated>2014-09-30T16:23:27Z</updated>

		<summary type="html">&lt;p&gt;Lkw: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; or type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n = 2M&amp;lt;/math&amp;gt;, imagine that we could extend &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.keys by one more slot (and, consequently, extend .successors by one more slot). Then &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; at a position such that - except for the statement about the size of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; - all implementation invariants of B-trees are again maintained after insertion.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The height level of the node to which &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points is decreased by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;p.N &amp;lt; 2M&amp;lt;/math&amp;gt; or (that is, inclusive-or) &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the root.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' '''''p''''' is initialized so as to point to the root of the B-tree.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# Let '''''N''''' denote the node to which '''''p''''' currently points.&lt;br /&gt;
# If the searched key is in '''''N''''', terminate the algorithm and return '''''true'''''.&lt;br /&gt;
# Otherwise, if '''''N''''' is a leaf, terminate the algorithm and return '''''false'''''.&lt;br /&gt;
# Otherwise, let '''''p''''' point the child of '''''N''''' such that the searched key is in the [[Directed Tree#Ranges of Search Tree Nodes|range]] of that child&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If '''''K''''' is one of the values &amp;lt;math&amp;gt;p.keys[1],\dots,p.keys[p.n]&amp;lt;/math&amp;gt;, terminate the algorithm and return '''''true'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.children[0] = void&amp;lt;/math&amp;gt; (that is, the current node is a leaf), terminate the algorithm and return '''''false'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;K &amp;lt; p.keys[1]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if &amp;lt;math&amp;gt;K &amp;gt; p.keys[p.n]&amp;lt;/math set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, there is exactly one &amp;lt;math&amp;gt;i \in \{1,\dots,p.n-1\}&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;p.keys[i] &amp;lt; K &amp;lt; p.keys[i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p := p.children[i]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Follows immediately from the fact that the height of B-tree with '''''n''''' nodes is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; (cf. the remark clause of the [[B-Trees]] page).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=421</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=421"/>
		<updated>2014-09-30T16:19:17Z</updated>

		<summary type="html">&lt;p&gt;Lkw: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers &amp;lt;math&amp;gt;p, p_1, p_2 &amp;lt;/math&amp;gt; or type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to a node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that the following holds: &lt;br /&gt;
# In the case &amp;lt;math&amp;gt;p.n &amp;lt; 2M&amp;lt;/math&amp;gt;, all implementation invariants of B-trees are maintained if the following &amp;lt;math&amp;gt;K'&amp;lt;/math&amp;gt; can be inserted at some position in &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; such that after insertion.&lt;br /&gt;
# the searched key is in the [[Directed Tree#Ranges of Search Tree Nodes|range]] of '''''N'''''.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' '''''p''''' is redirected from the current node '''''N''''' to some child of the current node.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:'''&lt;br /&gt;
# '''''p''''' points to a leaf of the B-tree or (that is, inclusive-or)&lt;br /&gt;
# the searched key is in the node to which '''''p''''' points.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' '''''p''''' is initialized so as to point to the root of the B-tree.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# Let '''''N''''' denote the node to which '''''p''''' currently points.&lt;br /&gt;
# If the searched key is in '''''N''''', terminate the algorithm and return '''''true'''''.&lt;br /&gt;
# Otherwise, if '''''N''''' is a leaf, terminate the algorithm and return '''''false'''''.&lt;br /&gt;
# Otherwise, let '''''p''''' point the child of '''''N''''' such that the searched key is in the [[Directed Tree#Ranges of Search Tree Nodes|range]] of that child&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If '''''K''''' is one of the values &amp;lt;math&amp;gt;p.keys[1],\dots,p.keys[p.n]&amp;lt;/math&amp;gt;, terminate the algorithm and return '''''true'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.children[0] = void&amp;lt;/math&amp;gt; (that is, the current node is a leaf), terminate the algorithm and return '''''false'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;K &amp;lt; p.keys[1]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if &amp;lt;math&amp;gt;K &amp;gt; p.keys[p.n]&amp;lt;/math set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, there is exactly one &amp;lt;math&amp;gt;i \in \{1,\dots,p.n-1\}&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;p.keys[i] &amp;lt; K &amp;lt; p.keys[i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p := p.children[i]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Follows immediately from the fact that the height of B-tree with '''''n''''' nodes is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; (cf. the remark clause of the [[B-Trees]] page).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=418</id>
		<title>B-tree: insert and rearrange</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert_and_rearrange&amp;diff=418"/>
		<updated>2014-09-30T16:08:08Z</updated>

		<summary type="html">&lt;p&gt;Lkw: Created page with &amp;quot;Category:B-Tree Category:Algorithm == General Information == '''Algorithmic problem:''' Text here  '''Type of algorithm:''' Text  '''Auxiliary data:'''  # Three po...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:B-Tree]]&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
== General Information ==&lt;br /&gt;
'''Algorithmic problem:''' [[Text here]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' Text&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' &lt;br /&gt;
# Three pointers ''p'', ''p''&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ''p''&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; or type &amp;quot;pointer to B-tree node&amp;quot;.&lt;br /&gt;
# A current key &amp;lt;math&amp;gt; K' \in K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' Before and after each iteration:&lt;br /&gt;
# '''''p''''' points to some node '''''N''''' of the B-tree and&lt;br /&gt;
# the searched key is in the [[Directed Tree#Ranges of Search Tree Nodes|range]] of '''''N'''''.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' '''''p''''' is redirected from the current node '''''N''''' to some child of the current node.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:'''&lt;br /&gt;
# '''''p''''' points to a leaf of the B-tree or (that is, inclusive-or)&lt;br /&gt;
# the searched key is in the node to which '''''p''''' points.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
'''Abstract view:''' '''''p''''' is initialized so as to point to the root of the B-tree.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
== Induction Step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# Let '''''N''''' denote the node to which '''''p''''' currently points.&lt;br /&gt;
# If the searched key is in '''''N''''', terminate the algorithm and return '''''true'''''.&lt;br /&gt;
# Otherwise, if '''''N''''' is a leaf, terminate the algorithm and return '''''false'''''.&lt;br /&gt;
# Otherwise, let '''''p''''' point the child of '''''N''''' such that the searched key is in the [[Directed Tree#Ranges of Search Tree Nodes|range]] of that child&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If '''''K''''' is one of the values &amp;lt;math&amp;gt;p.keys[1],\dots,p.keys[p.n]&amp;lt;/math&amp;gt;, terminate the algorithm and return '''''true'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p.children[0] = void&amp;lt;/math&amp;gt; (that is, the current node is a leaf), terminate the algorithm and return '''''false'''''.&lt;br /&gt;
# If &amp;lt;math&amp;gt;K &amp;lt; p.keys[1]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if &amp;lt;math&amp;gt;K &amp;gt; p.keys[p.n]&amp;lt;/math set &amp;lt;math&amp;gt;p := p.children[p.n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, there is exactly one &amp;lt;math&amp;gt;i \in \{1,\dots,p.n-1\}&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;p.keys[i] &amp;lt; K &amp;lt; p.keys[i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p := p.children[i]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Follows immediately from the fact that the height of B-tree with '''''n''''' nodes is in &amp;lt;math&amp;gt;\Theta(\log n)&amp;lt;/math&amp;gt; (cf. the remark clause of the [[B-Trees]] page).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_split&amp;diff=304</id>
		<title>B-tree: split</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_split&amp;diff=304"/>
		<updated>2014-09-25T20:25:15Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-SPLIT-CHILD(''x'', ''i'')&lt;br /&gt;
  1 ''z'' = ALLOCATE-NODE()&lt;br /&gt;
  2 ''y'' = ''x''.''c''&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;&lt;br /&gt;
  3 ''z''.''leaf'' = ''y.leaf''&lt;br /&gt;
  4 ''z.n'' = ''t'' - 1&lt;br /&gt;
  5 '''for''' ''j'' = 1 '''to''' ''t'' - 1&lt;br /&gt;
  6           ''z.key''&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt; = ''y.key''&amp;lt;sub&amp;gt;j + t&amp;lt;/sub&amp;gt;&lt;br /&gt;
  7 '''if''' not ''y.leaf''&lt;br /&gt;
  8          '''for''' ''j'' = 1 to t&lt;br /&gt;
  9              ''z.c''&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt; = ''y.c''&amp;lt;sub&amp;gt;j + t&amp;lt;/sub&amp;gt;&lt;br /&gt;
 10 ''y.n'' = ''t'' - 1 &lt;br /&gt;
 11 '''for''' ''j'' = ''x.n'' + 1 '''downto''' ''i'' + 1&lt;br /&gt;
 12           ''x.c''&amp;lt;sub&amp;gt;j + 1&amp;lt;/sub&amp;gt; = ''x.c''&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt;&lt;br /&gt;
 13 ''x.c''&amp;lt;sub&amp;gt;i + 1&amp;lt;/sub&amp;gt; = ''z''&lt;br /&gt;
 14 '''for''' ''j'' = ''x.n'' '''downto''' ''i''&lt;br /&gt;
 15           ''x.key''&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; = ''y.key''&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt;&lt;br /&gt;
 16 ''x.key''&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; = ''y.key''&amp;lt;sub&amp;gt;t&amp;lt;/sub&amp;gt;&lt;br /&gt;
 17 ''x.n'' = ''x.n'' + 1&lt;br /&gt;
 18 DISK-WRITE(''y'')&lt;br /&gt;
 19 DISK-WRITE(''z'')&lt;br /&gt;
 20 DISK-WRITE(''x'')&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=303</id>
		<title>B-tree: insert</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=303"/>
		<updated>2014-09-25T20:23:17Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* B-TREE-INSERT-NONFULL(x,k) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Pseudocode = &lt;br /&gt;
&lt;br /&gt;
=== B-TREE-INSERT(''T'',''k'') ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT(''T'',''k'')&lt;br /&gt;
  1 ''r'' = ''T.root''&lt;br /&gt;
  2 '''if''' ''r.n'' == 2''t'' - 1&lt;br /&gt;
  3      ''s'' = ALLOCATE-NODE()&lt;br /&gt;
  4      ''T.root'' = ''s''&lt;br /&gt;
  5      ''s.leaf'' = FALSE&lt;br /&gt;
  6      ''s.n'' = 0&lt;br /&gt;
  7      ''s.c&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;'' = ''r''&lt;br /&gt;
  8      B-TREE-SPLIT-CHILD(''s'', 1)&lt;br /&gt;
  9      B-TREE-INSERT-NONFULL(''s, k'')&lt;br /&gt;
 10 '''else''' B-TREE-INSERT-NONFULL(''r, k'')   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== B-TREE-INSERT-NONFULL(''x'',''k'') ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT-NONFULL(''x'',''k'')&lt;br /&gt;
  1 ''i'' = ''x.n''&lt;br /&gt;
  2 '''if''' ''x.leaf''&lt;br /&gt;
  3      '''while''' ''i &amp;amp;ge; 1 and ''k'' &amp;lt; ''x.key''&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;&lt;br /&gt;
  4              ''x.key''&amp;lt;sub&amp;gt;i+1&amp;lt;/sub&amp;gt;= ''x.key''&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;&lt;br /&gt;
  5              ''i'' = ''i'' - 1&lt;br /&gt;
  6      ''x.key''&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;+111 = ''k''&lt;br /&gt;
  7      ''x.n'' = ''x.n'' + 1&lt;br /&gt;
  8      DISK-WRITE(''x)&lt;br /&gt;
  9 '''else while''' ''i'' &amp;amp;ge; 1 and ''k'' &amp;lt; ''x.key''&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;&lt;br /&gt;
 10             ''i'' = ''i'' - 1&lt;br /&gt;
 11        ''i'' = ''i'' + 1&lt;br /&gt;
 12        DISK-READ(''x.c''&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;)&lt;br /&gt;
 13        '''if''' ''x.c&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;.n'' == 2''t'' - 1&lt;br /&gt;
 14               B-TREE-SPLIT-CHILD(''x, i'')&lt;br /&gt;
 15               '''if''' ''k'' &amp;gt; ''x.key''&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;&lt;br /&gt;
 16                       ''i'' = ''i'' + 1&lt;br /&gt;
 17         B-TREE-INSERT-NONFULL(''x.c&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;, k)   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=302</id>
		<title>B-tree: insert</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=302"/>
		<updated>2014-09-25T20:21:56Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* B-TREE-INSERT(T,k) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Pseudocode = &lt;br /&gt;
&lt;br /&gt;
=== B-TREE-INSERT(''T'',''k'') ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT(''T'',''k'')&lt;br /&gt;
  1 ''r'' = ''T.root''&lt;br /&gt;
  2 '''if''' ''r.n'' == 2''t'' - 1&lt;br /&gt;
  3      ''s'' = ALLOCATE-NODE()&lt;br /&gt;
  4      ''T.root'' = ''s''&lt;br /&gt;
  5      ''s.leaf'' = FALSE&lt;br /&gt;
  6      ''s.n'' = 0&lt;br /&gt;
  7      ''s.c&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;'' = ''r''&lt;br /&gt;
  8      B-TREE-SPLIT-CHILD(''s'', 1)&lt;br /&gt;
  9      B-TREE-INSERT-NONFULL(''s, k'')&lt;br /&gt;
 10 '''else''' B-TREE-INSERT-NONFULL(''r, k'')   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== B-TREE-INSERT-NONFULL(''x'',''k'') ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT-NONFULL(''x'',''k'')&lt;br /&gt;
  1 ''i'' = ''x.n''&lt;br /&gt;
  2 '''if''' ''x.leaf''&lt;br /&gt;
  3      '''while''' ''i &amp;amp;ge; 1 and ''k'' &amp;lt; ''x.key''iiiii&lt;br /&gt;
  4              ''x.key''iii+111 = ''x.key''iiiii&lt;br /&gt;
  5              ''i'' = ''i'' - 1&lt;br /&gt;
  6      ''x.key''iii+111 = ''k''&lt;br /&gt;
  7      ''x.n'' = ''x.n'' + 1&lt;br /&gt;
  8      DISK-WRITE(''x)&lt;br /&gt;
  9 '''else while''' ''i'' &amp;amp;ge; 1 and ''k'' &amp;lt; ''x.key''iiiii&lt;br /&gt;
 10             ''i'' = ''i'' - 1&lt;br /&gt;
 11        ''i'' = ''i'' + 1&lt;br /&gt;
 12        DISK-READ(''x.c''iiii)&lt;br /&gt;
 13        '''if''' ''x.ciiii.n'' == 2''t'' - 1&lt;br /&gt;
 14               B-TREE-SPLIT-CHILD(''x, i'')&lt;br /&gt;
 15               '''if''' ''k'' &amp;gt; ''x.key''iiii&lt;br /&gt;
 16                       ''i'' = ''i'' + 1&lt;br /&gt;
 17         B-TREE-INSERT-NONFULL(''x.ciii, k)   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=301</id>
		<title>Master theorem</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=301"/>
		<updated>2014-09-25T20:21:10Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* MASTER THEOREM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== MASTER THEOREM ==&lt;br /&gt;
Let a &amp;amp;ge; 1 and b &amp;gt; 1 be constants, let ''f''(''n'') be a function, and let ''T''(''n'') be defined on the nonnegative integers by the recurrence&lt;br /&gt;
&lt;br /&gt;
''T''(''n'') = ''aT''(''n''/''b'') + ''f'' (''n''),&lt;br /&gt;
&lt;br /&gt;
where we interpret ''n''/''b'' to mean either &amp;amp;lfloor;''n''/''b''&amp;amp;rfloor; or &amp;amp;lceil;''n''/''b''&amp;amp;rceil;. Then ''T''(''n'') can be bounded asymptotically as follows.&lt;br /&gt;
&lt;br /&gt;
1. If  ''f'' (''n'') = ''O''(''n&amp;lt;sup&amp;gt;log&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt; a - &amp;amp;epsilon;&amp;lt;/sup&amp;gt;)  for some constant &amp;amp;epsilon; &amp;gt; 0, then ''T''(''n'') = &amp;amp;Theta;(n&amp;lt;sup&amp;gt;log&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt; a&amp;lt;/sup&amp;gt;). &amp;lt;br&amp;gt;&lt;br /&gt;
2. If ''f'' (''n'') = &amp;amp;Theta;(''n''&amp;lt;sup&amp;gt;log &amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt; a&amp;lt;/sup&amp;gt;), then ''T''(''n'') = &amp;amp;Theta;(n&amp;lt;sup&amp;gt;log&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt; a&amp;lt;/sup&amp;gt; lg n). &amp;lt;br&amp;gt;&lt;br /&gt;
3. If ''f'' (''n'') = &amp;amp;Omega;(n&amp;lt;sup&amp;gt;log&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt; a + &amp;amp;epsilon;&amp;lt;/sup&amp;gt;) for some constant &amp;amp;epsilon; &amp;gt; 0, and if ''af''(''n/b'') &amp;amp;le; ''cf''(''n'') for some constant ''c'' &amp;lt; 1 and all sufficiently large ''n'', then ''T''(''n'') = &amp;amp;Omega;(''f'' (''n'')).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=300</id>
		<title>Master theorem</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=300"/>
		<updated>2014-09-25T20:20:40Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* MASTER THEOREM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== MASTER THEOREM ==&lt;br /&gt;
Let a &amp;amp;ge; 1 and b &amp;gt; 1 be constants, let ''f''(''n'') be a function, and let ''T''(''n'') be defined on the nonnegative integers by the recurrence&lt;br /&gt;
&lt;br /&gt;
''T''(''n'') = ''aT''(''n''/''b'') + ''f'' (''n''),&lt;br /&gt;
&lt;br /&gt;
where we interpret ''n''/''b'' to mean either &amp;amp;lfloor;''n''/''b''&amp;amp;rfloor; or &amp;amp;lceil;''n''/''b''&amp;amp;rceil;. Then ''T''(''n'') can be bounded asymptotically as follows.&lt;br /&gt;
&lt;br /&gt;
1. If  ''f'' (''n'') = ''O''(''n&amp;lt;sup&amp;gt;log&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt; a - &amp;amp;epsilon;&amp;lt;/sup&amp;gt;)  for some constant &amp;amp;epsilon; &amp;gt; 0, then ''T''(''n'') = &amp;amp;Theta;(n^&amp;lt;sup&amp;gt;log&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt; a&amp;lt;/sup&amp;gt;). &amp;lt;br&amp;gt;&lt;br /&gt;
2. If ''f'' (''n'') = &amp;amp;Theta;(''n''&amp;lt;sup&amp;gt;log &amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt; a&amp;lt;/sup&amp;gt;), then ''T''(''n'') = &amp;amp;Theta;(n&amp;lt;sup&amp;gt;log&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt; a&amp;lt;/sup&amp;gt; lg n). &amp;lt;br&amp;gt;&lt;br /&gt;
3. If ''f'' (''n'') = &amp;amp;Omega;(n&amp;lt;sup&amp;gt;log&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt; a + &amp;amp;epsilon;&amp;lt;/sup&amp;gt;) for some constant &amp;amp;epsilon; &amp;gt; 0, and if ''af''(''n/b'') &amp;amp;le; ''cf''(''n'') for some constant ''c'' &amp;lt; 1 and all sufficiently large ''n'', then ''T''(''n'') = &amp;amp;Omega;(''f'' (''n'')).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=299</id>
		<title>Master theorem</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=299"/>
		<updated>2014-09-25T20:18:04Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* MASTER THEOREM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== MASTER THEOREM ==&lt;br /&gt;
Let a &amp;amp;ge; 1 and b &amp;gt; 1 be constants, let ''f''(''n'') be a function, and let ''T''(''n'') be defined on the nonnegative integers by the recurrence&lt;br /&gt;
&lt;br /&gt;
''T''(''n'') = ''aT''(''n''/''b'') + ''f'' (''n''),&lt;br /&gt;
&lt;br /&gt;
where we interpret ''n''/''b'' to mean either &amp;amp;lfloor;''n''/''b''&amp;amp;rfloor; or &amp;amp;lceil;''n''/''b''&amp;amp;rceil;. Then ''T''(''n'') can be bounded asymptotically as follows.&lt;br /&gt;
&lt;br /&gt;
1. If  ''f'' (''n'') = ''O''(''n&amp;lt;sup&amp;gt;logba - &amp;amp;epsilon;&amp;lt;/sup&amp;gt;)  for some constant &amp;amp;epsilon; &amp;gt; 0, then ''T''(''n'') = &amp;amp;Theta;(n^&amp;lt;sup&amp;gt;log&amp;lt;/sup&amp;gt;). &amp;lt;br&amp;gt;&lt;br /&gt;
2. If ''f'' (''n'') = &amp;amp;Theta;(''n''&amp;lt;sup&amp;gt;log b a&amp;lt;/sup&amp;gt;), then ''T''(''n'') = &amp;amp;Theta;(n&amp;lt;sup&amp;gt;log b a&amp;lt;/sup&amp;gt; lg n). &amp;lt;br&amp;gt;&lt;br /&gt;
3. If ''f'' (''n'') = &amp;amp;Omega;(n&amp;lt;sup&amp;gt;log b a + &amp;amp;epsilon;&amp;lt;/sup&amp;gt;) for some constant &amp;amp;epsilon; &amp;gt; 0, and if ''af''(''n/b'') &amp;amp;le; ''cf''(''n'') for some constant ''c'' &amp;lt; 1 and all sufficiently large ''n'', then ''T''(''n'') = &amp;amp;Omega;(''f''(''n'')).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=298</id>
		<title>Master theorem</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=298"/>
		<updated>2014-09-25T20:17:25Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* MASTER THEOREM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== MASTER THEOREM ==&lt;br /&gt;
Let a &amp;amp;ge; 1 and b &amp;gt; 1 be constants, let ''f''(''n'') be a function, and let ''T''(''n'') be defined on the nonnegative integers by the recurrence&lt;br /&gt;
&lt;br /&gt;
''T''(''n'') = ''aT''(''n''/''b'') + ''f''(''n''),&lt;br /&gt;
&lt;br /&gt;
where we interpret ''n''/''b'' to mean either &amp;amp;lfloor;''n''/''b''&amp;amp;rfloor; or &amp;amp;lceil;''n''/''b''&amp;amp;rceil;. Then ''T''(''n'') can be bounded asymptotically as follows.&lt;br /&gt;
&lt;br /&gt;
1. If  ''f''(''n'') = ''O''(''n&amp;lt;sup&amp;gt;logba - &amp;amp;epsilon;&amp;lt;/sup&amp;gt;)  for some constant &amp;amp;epsilon; &amp;gt; 0, then ''T''(''n'') = &amp;amp;Theta;(n^&amp;lt;sup&amp;gt;log&amp;lt;/sup&amp;gt;). &amp;lt;br&amp;gt;&lt;br /&gt;
2. If ''f''(''n'') = &amp;amp;Theta;(''n''&amp;lt;sup&amp;gt;log b a&amp;lt;/sup&amp;gt;), then ''T''(''n'') = &amp;amp;Theta;(n&amp;lt;sup&amp;gt;log b a&amp;lt;/sup&amp;gt; lg n). &amp;lt;br&amp;gt;&lt;br /&gt;
3. If ''f''(''n'') = &amp;amp;Omega;(n&amp;lt;sup&amp;gt;log b a + &amp;amp;epsilon;&amp;lt;/sup&amp;gt;) for some constant &amp;amp;epsilon; &amp;gt; 0, and if ''af''(''n/b'') &amp;amp;le; ''cf''(''n'') for some constant ''c'' &amp;lt; 1 and all sufficiently large ''n'', then ''T''(''n'') = &amp;amp;Omega;(''f''(''n'')).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=297</id>
		<title>Master theorem</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=297"/>
		<updated>2014-09-25T20:16:11Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* MASTER THEOREM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== MASTER THEOREM ==&lt;br /&gt;
Let a &amp;amp;ge; 1 and b &amp;gt; 1 be constants, let ''f''(''n'') be a function, and let ''T''(''n'') be defined on the nonnegative integers by the recurrence&lt;br /&gt;
&lt;br /&gt;
''T''(''n'') = ''aT''(''n''/''b'') + ''f''(''n''),&lt;br /&gt;
&lt;br /&gt;
where we interpret ''n''/''b'' to mean either &amp;amp;lfloor;''n''/''b''&amp;amp;rfloor; or &amp;amp;lceil;''n''/''b''&amp;amp;rceil;. Then ''T''(''n'') can be bounded asymptotically as follows.&lt;br /&gt;
&lt;br /&gt;
1. If  ''f''(''n'') = ''O''(''n&amp;lt;sup&amp;gt;logba - &amp;amp;epsilon;&amp;lt;/sup&amp;gt;)  for some constant &amp;amp;epsilon; &amp;gt; 0, then ''T''(''n'') = &amp;amp;Theta;(n^&amp;lt;sup&amp;gt;log&amp;lt;/sup&amp;gt;). &amp;lt;p&amp;gt;&lt;br /&gt;
2. If ''f''(''n'') = &amp;amp;Theta;(''n''&amp;lt;sup&amp;gt;log b a&amp;lt;/sup&amp;gt;), then ''T''(''n'') = &amp;amp;Theta;(n&amp;lt;sup&amp;gt;log b a&amp;lt;/sup&amp;gt; lg n). &amp;lt;p&amp;gt;&lt;br /&gt;
3. If ''f''(''n'') = &amp;amp;Omega;(n&amp;lt;sup&amp;gt;log b a + &amp;amp;epsilon;&amp;lt;/sup&amp;gt;) for some constant &amp;amp;epsilon; &amp;gt; 0, and if ''af''(''n/b'') &amp;amp;le; ''cf''(''n'') for some constant ''c'' &amp;lt; 1 and all sufficiently large ''n'', then ''T''(''n'') = &amp;amp;Omega;(''f''(''n'')).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=296</id>
		<title>Master theorem</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=296"/>
		<updated>2014-09-25T20:14:25Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* MASTER THEOREM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== MASTER THEOREM ==&lt;br /&gt;
Let a &amp;amp;ge; 1 and b &amp;gt; 1 be constants, let ''f''(''n'') be a function, and let ''T''(''n'') be defined on the nonnegative integers by the recurrence&lt;br /&gt;
&lt;br /&gt;
''T''(''n'') = ''aT''(''n''/''b'') + ''f''(''n''),&lt;br /&gt;
&lt;br /&gt;
where we interpret ''n''/''b'' to mean either &amp;amp;lfloor;''n''/''b''&amp;amp;rfloor; or &amp;amp;lceil;''n''/''b''&amp;amp;rceil;. Then ''T''(''n'') can be bounded asymptotically as follows.&lt;br /&gt;
&lt;br /&gt;
1. If  ''f''(''n'') = ''O''(''n&amp;lt;sup&amp;gt;logba - &amp;amp;epsilon;&amp;lt;/sup&amp;gt;)  for some constant &amp;amp;epsilon; &amp;gt; 0, then ''T''(''n'') = &amp;amp;Theta;(n^&amp;lt;sup&amp;gt;log&amp;lt;/sup&amp;gt;).&lt;br /&gt;
2. If ''f''(''n'') = &amp;amp;Theta;(''n''&amp;lt;sup&amp;gt;log b a&amp;lt;/sup&amp;gt;), then ''T''(''n'') = &amp;amp;Theta;(n&amp;lt;sup&amp;gt;log b a&amp;lt;/sup&amp;gt; lg n).&lt;br /&gt;
3. If ''f''(''n'') = &amp;amp;Omega;(n&amp;lt;sup&amp;gt;log b a + &amp;amp;epsilon;&amp;lt;/sup&amp;gt;) for some constant &amp;amp;epsilon; &amp;gt; 0, and if ''af''(''n/b'') &amp;amp;le; ''cf''(''n'') for some constant ''c'' &amp;lt; 1 and all sufficiently large ''n'', then ''T''(''n'') = &amp;amp;Omega;(''f''(''n'')).&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=294</id>
		<title>Master theorem</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=294"/>
		<updated>2014-09-25T20:08:21Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* MASTER THEOREM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== MASTER THEOREM ==&lt;br /&gt;
Let a &amp;amp;ge; 1 and b &amp;gt; 1 be constants, let ''f''(''n'') be a function, and let ''T''(''n'') be defined on the nonnegative integers by the recurrence&lt;br /&gt;
&lt;br /&gt;
''T''(''n'') = ''aT''(''n''/''b'') + ''f''(''n''),&lt;br /&gt;
&lt;br /&gt;
where we interpret ''n''/''b'' to mean either &amp;amp;lfloor;''n''/''b''&amp;amp;rfloor; or &amp;amp;lceil;''n''/''b''&amp;amp;rceil;. Then ''T''(''n'') can be bounded asymptotically as follows.&lt;br /&gt;
&lt;br /&gt;
1. If  ''f''(''n'') = ''O''(''n&amp;lt;sup&amp;gt;logba - &amp;amp;epsilon;&amp;lt;/sup&amp;gt;)  for some constant &amp;amp;epsilon; &amp;gt; 0, then ''T''(''n'') = &amp;amp;Theta;(n^&amp;lt;sup&amp;gt;log&amp;lt;/sup&amp;gt;)&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=293</id>
		<title>Master theorem</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=293"/>
		<updated>2014-09-25T20:07:13Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* MASTER THEOREM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== MASTER THEOREM ==&lt;br /&gt;
Let a &amp;amp;ge; 1 and b &amp;gt; 1 be constants, let ''f''(''n'') be a function, and let ''T''(''n'') be defined on the nonnegative integers by the recurrence&lt;br /&gt;
&lt;br /&gt;
''T''(''n'') = ''aT''(''n''/''b'') + ''f''(''n''),&lt;br /&gt;
&lt;br /&gt;
where we interpret ''n''/''b'' to mean either &amp;amp;lfloor;''n''/''b''&amp;amp;rfloor; or &amp;amp;lceil;''n''/''b''&amp;amp;rceil;. Then ''T''(''n'') can be bounded asymptotically as follows.&lt;br /&gt;
&lt;br /&gt;
1. If  ''f''(''n'') = ''O''(''n^(logba - &amp;amp;epsilon;))  for some constant &amp;amp;epsilon; &amp;gt; 0, then ''T''(''n'') = &amp;amp;Theta;(n^log)&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=274</id>
		<title>Master theorem</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Master_theorem&amp;diff=274"/>
		<updated>2014-09-25T18:51:40Z</updated>

		<summary type="html">&lt;p&gt;Lkw: Created page with &amp;quot;== MASTER THEOREM == Let a &amp;amp;ge; 1 and b &amp;gt; 1 be constants, let ''f''(''n'') be a function, and let ''T''(''n'') be defined on the nonnegative integers by the recurrence  ''T''(...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== MASTER THEOREM ==&lt;br /&gt;
Let a &amp;amp;ge; 1 and b &amp;gt; 1 be constants, let ''f''(''n'') be a function, and let ''T''(''n'') be defined on the nonnegative integers by the recurrence&lt;br /&gt;
&lt;br /&gt;
''T''(''n'') = ''aT''(''n''/''b'') + ''f''(''n''),&lt;br /&gt;
&lt;br /&gt;
where we interpret ''n''/''b'' to mean either &amp;amp;lfloor;''n''/''b''&amp;amp;rfloor; or &amp;amp;lceil;''n''/''b''&amp;amp;rceil;. Then ''T''(''n'') can be bounded asymptotically as follows.&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Prim&amp;diff=270</id>
		<title>Prim</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Prim&amp;diff=270"/>
		<updated>2014-09-25T18:34:21Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* MST-PRIM(G,w,r) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
=== MST-PRIM(''G,w,r'') ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
MST-PRIM(''G,w,r'')&lt;br /&gt;
  1  '''for''' each vertex ''u'' &amp;amp;isin; ''V''[''G''] &lt;br /&gt;
  2       '''do''' ''key''[''u''] = &amp;amp;infin;&lt;br /&gt;
  3                &amp;amp;pi;[''u''] = NIL&lt;br /&gt;
  4  ''key''[''r''] = 0&lt;br /&gt;
  5  ''Q'' = ''V''[''G'']&lt;br /&gt;
  6  '''while''' ''Q'' &amp;amp;ne; &amp;amp;Oslash;&lt;br /&gt;
  7       '''do''' ''u'' = EXTRACT-MIN(''Q'')&lt;br /&gt;
  8                '''for''' each v &amp;amp;isin; ''Adj[u]''&lt;br /&gt;
  9                       '''do if''' v &amp;amp;isin; ''Q'' and ''w(u,v)'' &amp;lt; ''key''[''v'']&lt;br /&gt;
 10                              '''then''' &amp;amp;pi;[''v''] = ''u''&lt;br /&gt;
 11                                      ''key''[''v''] = ''w(u,v)''&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Prim&amp;diff=269</id>
		<title>Prim</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Prim&amp;diff=269"/>
		<updated>2014-09-25T18:33:07Z</updated>

		<summary type="html">&lt;p&gt;Lkw: Created page with &amp;quot;== Pseudocode ==   === MST-PRIM(''G,w,r'') ===  &amp;lt;code&amp;gt; MST-PRIM(''G,w,r'')   1  '''for''' each vertex ''u'' &amp;amp;isin; V[''G'']    2       '''do''' ''key[''u''] = &amp;amp;infin;   3...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
=== MST-PRIM(''G,w,r'') ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
MST-PRIM(''G,w,r'')&lt;br /&gt;
  1  '''for''' each vertex ''u'' &amp;amp;isin; V[''G''] &lt;br /&gt;
  2       '''do''' ''key[''u''] = &amp;amp;infin;&lt;br /&gt;
  3                &amp;amp;pi;[''u''] = NIL&lt;br /&gt;
  4  ''key[r] = 0&lt;br /&gt;
  5  ''Q'' = ''V[G]''&lt;br /&gt;
  6  '''while''' ''Q'' &amp;amp;ne; &amp;amp;Oslash;&lt;br /&gt;
  7       '''do''' ''u'' = EXTRACT-MIN(''Q'')&lt;br /&gt;
  8                '''for''' each v &amp;amp;isin; ''Adj[u]''&lt;br /&gt;
  9                       '''do if''' v &amp;amp;isin; ''Q'' and ''w(u,v)'' &amp;lt; ''key[v]&lt;br /&gt;
 10                              '''then''' &amp;amp;pi;[''v''] = ''u''&lt;br /&gt;
 11                                      ''key[v] = ''w(u,v)''&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=266</id>
		<title>B-tree: insert</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=266"/>
		<updated>2014-09-25T17:48:25Z</updated>

		<summary type="html">&lt;p&gt;Lkw: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Pseudocode = &lt;br /&gt;
&lt;br /&gt;
=== B-TREE-INSERT(''T'',''k'') ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT(''T'',''k'')&lt;br /&gt;
  1 ''r'' = ''T.root''&lt;br /&gt;
  2 '''if''' ''r.n'' == 2''t'' - 1&lt;br /&gt;
  3      ''s'' = ALLOCATE-NODE()&lt;br /&gt;
  4      ''T.root'' = ''s''&lt;br /&gt;
  5      ''s.leaf'' = FALSE&lt;br /&gt;
  6      ''s.n'' = 0&lt;br /&gt;
  7      ''s.c1111'' = ''r''&lt;br /&gt;
  8      B-TREE-SPLIT-CHILD(''s'', 1)&lt;br /&gt;
  9      B-TREE-INSERT-NONFULL(''s, k'')&lt;br /&gt;
 10 '''else''' B-TREE-INSERT-NONFULL(''r, k'')   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== B-TREE-INSERT-NONFULL(''x'',''k'') ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT-NONFULL(''x'',''k'')&lt;br /&gt;
  1 ''i'' = ''x.n''&lt;br /&gt;
  2 '''if''' ''x.leaf''&lt;br /&gt;
  3      '''while''' ''i &amp;amp;ge; 1 and ''k'' &amp;lt; ''x.key''iiiii&lt;br /&gt;
  4              ''x.key''iii+111 = ''x.key''iiiii&lt;br /&gt;
  5              ''i'' = ''i'' - 1&lt;br /&gt;
  6      ''x.key''iii+111 = ''k''&lt;br /&gt;
  7      ''x.n'' = ''x.n'' + 1&lt;br /&gt;
  8      DISK-WRITE(''x)&lt;br /&gt;
  9 '''else while''' ''i'' &amp;amp;ge; 1 and ''k'' &amp;lt; ''x.key''iiiii&lt;br /&gt;
 10             ''i'' = ''i'' - 1&lt;br /&gt;
 11        ''i'' = ''i'' + 1&lt;br /&gt;
 12        DISK-READ(''x.c''iiii)&lt;br /&gt;
 13        '''if''' ''x.ciiii.n'' == 2''t'' - 1&lt;br /&gt;
 14               B-TREE-SPLIT-CHILD(''x, i'')&lt;br /&gt;
 15               '''if''' ''k'' &amp;gt; ''x.key''iiii&lt;br /&gt;
 16                       ''i'' = ''i'' + 1&lt;br /&gt;
 17         B-TREE-INSERT-NONFULL(''x.ciii, k)   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=265</id>
		<title>B-tree: insert</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=265"/>
		<updated>2014-09-25T17:44:56Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
= B-TREE-INSERT(''T'',''k'') =&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT(''T'',''k'')&lt;br /&gt;
  1 ''r'' = ''T.root''&lt;br /&gt;
  2 '''if''' ''r.n'' == 2''t'' - 1&lt;br /&gt;
  3      ''s'' = ALLOCATE-NODE()&lt;br /&gt;
  4      ''T.root'' = ''s''&lt;br /&gt;
  5      ''s.leaf'' = FALSE&lt;br /&gt;
  6      ''s.n'' = 0&lt;br /&gt;
  7      ''s.c1111'' = ''r''&lt;br /&gt;
  8      B-TREE-SPLIT-CHILD(''s'', 1)&lt;br /&gt;
  9      B-TREE-INSERT-NONFULL(''s, k'')&lt;br /&gt;
 10 '''else''' B-TREE-INSERT-NONFULL(''r, k'')   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= B-TREE-INSERT-NONFULL(''x'',''k'') =&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT-NONFULL(''x'',''k'')&lt;br /&gt;
  1 ''i'' = ''x.n''&lt;br /&gt;
  2 '''if''' ''x.leaf''&lt;br /&gt;
  3      '''while''' ''i &amp;amp;ge; 1 and ''k'' &amp;lt; ''x.key''iiiii&lt;br /&gt;
  4              ''x.key''iii+111 = ''x.key''iiiii&lt;br /&gt;
  5              ''i'' = ''i'' - 1&lt;br /&gt;
  6      ''x.key''iii+111 = ''k''&lt;br /&gt;
  7      ''x.n'' = ''x.n'' + 1&lt;br /&gt;
  8      DISK-WRITE(''x)&lt;br /&gt;
  9 '''else while''' ''i'' &amp;amp;ge; 1 and ''k'' &amp;lt; ''x.key''iiiii&lt;br /&gt;
 10             ''i'' = ''i'' - 1&lt;br /&gt;
 11        ''i'' = ''i'' + 1&lt;br /&gt;
 12        DISK-READ(''x.c''iiii)&lt;br /&gt;
 13        '''if''' ''x.ciiii.n'' == 2''t'' - 1&lt;br /&gt;
 14               B-TREE-SPLIT-CHILD(''x, i'')&lt;br /&gt;
 15               '''if''' ''k'' &amp;gt; ''x.key''iiii&lt;br /&gt;
 16                       ''i'' = ''i'' + 1&lt;br /&gt;
 17         B-TREE-INSERT-NONFULL(''x.ciii, k)   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=260</id>
		<title>Breadth-first search</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=260"/>
		<updated>2014-09-25T16:40:35Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 BFS(''G,s'')&lt;br /&gt;
  1  '''for''' each vertex ''u'' &amp;amp;isin; ''G.V'' - {''s''}&lt;br /&gt;
  2       ''u.color'' = WHITE&lt;br /&gt;
  3       ''u.d'' = &amp;amp;infin;&lt;br /&gt;
  4       ''u.''&amp;amp;pi; = NIL&lt;br /&gt;
  5  ''s.color'' = GRAY&lt;br /&gt;
  6  ''s.d'' = 0&lt;br /&gt;
  7  ''s.&amp;amp;pi;'' = NIL&lt;br /&gt;
  8  ''Q'' = &amp;amp;Oslash;&lt;br /&gt;
  9  ENQUE(''Q, s'')&lt;br /&gt;
 10  '''while''' ''Q'' &amp;amp;ne; &amp;amp;Oslash;&lt;br /&gt;
 11      ''u'' = DEQUEUE(''Q'')&lt;br /&gt;
 12      '''for''' each ''v'' &amp;amp;isin; ''G.Adj''[''u'']&lt;br /&gt;
 13              '''if''' ''v.color'' == WHITE&lt;br /&gt;
 14                       ''v.color'' = GRAY&lt;br /&gt;
 15                       ''v.d'' = ''u.d'' + 1&lt;br /&gt;
 16                       ''v''.&amp;amp;pi; = ''u''&lt;br /&gt;
 17                       ENQUEUE(''Q, v'')&lt;br /&gt;
 18      ''u.color'' = BLACK&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=259</id>
		<title>Breadth-first search</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=259"/>
		<updated>2014-09-25T16:40:15Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 BFS(''G,s'')&lt;br /&gt;
  1 '''for''' each vertex ''u'' &amp;amp;isin; ''G.V'' - {''s''}&lt;br /&gt;
  2       ''u.color'' = WHITE&lt;br /&gt;
  3       ''u.d'' = &amp;amp;infin;&lt;br /&gt;
  4       ''u.''&amp;amp;pi; = NIL&lt;br /&gt;
  5 ''s.color'' = GRAY&lt;br /&gt;
  6 ''s.d'' = 0&lt;br /&gt;
  7 ''s.&amp;amp;pi;'' = NIL&lt;br /&gt;
  8 ''Q'' = &amp;amp;Oslash;&lt;br /&gt;
  9 ENQUE(''Q, s'')&lt;br /&gt;
 10 '''while''' ''Q'' &amp;amp;ne; &amp;amp;Oslash;&lt;br /&gt;
 11      ''u'' = DEQUEUE(''Q'')&lt;br /&gt;
 12      '''for''' each ''v'' &amp;amp;isin; ''G.Adj''[''u'']&lt;br /&gt;
 13              '''if''' ''v.color'' == WHITE&lt;br /&gt;
 14                       ''v.color'' = GRAY&lt;br /&gt;
 15                       ''v.d'' = ''u.d'' + 1&lt;br /&gt;
 16                       ''v''.&amp;amp;pi; = ''u''&lt;br /&gt;
 17                       ENQUEUE(''Q, v'')&lt;br /&gt;
 18      ''u.color'' = BLACK&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=258</id>
		<title>Breadth-first search</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=258"/>
		<updated>2014-09-25T16:39:54Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 BFS(''G,s'')&lt;br /&gt;
  1 '''for''' each vertex ''u'' &amp;amp;isin; ''G.V'' - {''s''}&lt;br /&gt;
  2       ''u.color'' = WHITE&lt;br /&gt;
  3       ''u.d'' = &amp;amp;infin;&lt;br /&gt;
  4       ''u.''&amp;amp;pi; = NIL&lt;br /&gt;
  5  ''s.color'' = GRAY&lt;br /&gt;
  6  ''s.d'' = 0&lt;br /&gt;
  7  ''s.&amp;amp;pi;'' = NIL&lt;br /&gt;
  8  ''Q'' = &amp;amp;Oslash;&lt;br /&gt;
  9  ENQUE(''Q, s'')&lt;br /&gt;
 10 '''while''' ''Q'' &amp;amp;ne; &amp;amp;Oslash;&lt;br /&gt;
 11      ''u'' = DEQUEUE(''Q'')&lt;br /&gt;
 12      '''for''' each ''v'' &amp;amp;isin; ''G.Adj''[''u'']&lt;br /&gt;
 13              '''if''' ''v.color'' == WHITE&lt;br /&gt;
 14                       ''v.color'' = GRAY&lt;br /&gt;
 15                       ''v.d'' = ''u.d'' + 1&lt;br /&gt;
 16                       ''v''.&amp;amp;pi; = ''u''&lt;br /&gt;
 17                       ENQUEUE(''Q, v'')&lt;br /&gt;
 18      ''u.color'' = BLACK&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=254</id>
		<title>Breadth-first search</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=254"/>
		<updated>2014-09-25T16:30:11Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 BFS(''G,s'')&lt;br /&gt;
  1  '''for''' each vertex ''u'' &amp;amp;isin; ''G.V'' - {''s''}&lt;br /&gt;
  2       ''u.color'' = WHITE&lt;br /&gt;
  3       ''u.d'' = &amp;amp;infin;&lt;br /&gt;
  4       ''u.''&amp;amp;pi; = NIL&lt;br /&gt;
  5  ''s.color'' = GRAY&lt;br /&gt;
  6  ''s.d'' = 0&lt;br /&gt;
  7  ''s.&amp;amp;pi;'' = NIL&lt;br /&gt;
  8  ''Q'' = &amp;amp;Oslash;&lt;br /&gt;
  9  ENQUE(''Q, s'')&lt;br /&gt;
 10 '''while''' ''Q'' &amp;amp;ne; &amp;amp;Oslash;&lt;br /&gt;
 11      ''u'' = DEQUEUE(''Q'')&lt;br /&gt;
 12      '''for''' each ''v'' &amp;amp;isin; ''G.Adj''[''u'']&lt;br /&gt;
 13              '''if''' ''v.color'' == WHITE&lt;br /&gt;
 14                       ''v.color'' = GRAY&lt;br /&gt;
 15                       ''v.d'' = ''u.d'' + 1&lt;br /&gt;
 16                       ''v''.&amp;amp;pi; = ''u''&lt;br /&gt;
 17                       ENQUEUE(''Q, v'')&lt;br /&gt;
 18      ''u.color'' = BLACK&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=253</id>
		<title>Breadth-first search</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=253"/>
		<updated>2014-09-25T16:29:49Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 BFS(''G, s'')&lt;br /&gt;
  1  '''for''' each vertex ''u'' &amp;amp;isin; ''G.V'' - {''s''}&lt;br /&gt;
  2       ''u.color'' = WHITE&lt;br /&gt;
  3       ''u.d'' = &amp;amp;infin;&lt;br /&gt;
  4       ''u.''&amp;amp;pi; = NIL&lt;br /&gt;
  5  ''s.color'' = GRAY&lt;br /&gt;
  6  ''s.d'' = 0&lt;br /&gt;
  7  ''s.&amp;amp;pi;'' = NIL&lt;br /&gt;
  8  ''Q'' = &amp;amp;Oslash;&lt;br /&gt;
  9  ENQUE(''Q, s'')&lt;br /&gt;
 10 '''while''' ''Q'' &amp;amp;ne; &amp;amp;Oslash;&lt;br /&gt;
 11      ''u'' = DEQUEUE(''Q'')&lt;br /&gt;
 12      '''for''' each ''v'' &amp;amp;isin; ''G.Adj''[''u'']&lt;br /&gt;
 13              '''if''' ''v.color'' == WHITE&lt;br /&gt;
 14                       ''v.color'' = GRAY&lt;br /&gt;
 15                       ''v.d'' = ''u.d'' + 1&lt;br /&gt;
 16                       ''v''.&amp;amp;pi; = ''u''&lt;br /&gt;
 17                       ENQUEUE(''Q, v'')&lt;br /&gt;
 18      ''u.color'' = BLACK&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=252</id>
		<title>Breadth-first search</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Breadth-first_search&amp;diff=252"/>
		<updated>2014-09-25T16:29:26Z</updated>

		<summary type="html">&lt;p&gt;Lkw: Created page with &amp;quot;== Pseudocode ==   &amp;lt;code&amp;gt;  BFS(''G, s'')   1  '''for''' each vertex ''u'' &amp;amp;isin; ''G.V'' - {s}   2       ''u.color'' = WHITE   3       ''u.d'' = &amp;amp;infin;   4       ''u.''&amp;amp;pi; =...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 BFS(''G, s'')&lt;br /&gt;
  1  '''for''' each vertex ''u'' &amp;amp;isin; ''G.V'' - {s}&lt;br /&gt;
  2       ''u.color'' = WHITE&lt;br /&gt;
  3       ''u.d'' = &amp;amp;infin;&lt;br /&gt;
  4       ''u.''&amp;amp;pi; = NIL&lt;br /&gt;
  5  ''s.color'' = GRAY&lt;br /&gt;
  6  ''s.d'' = 0&lt;br /&gt;
  7  ''s.&amp;amp;pi;'' = NIL&lt;br /&gt;
  8  ''Q'' = &amp;amp;Oslash;&lt;br /&gt;
  9  ENQUE(''Q, s'')&lt;br /&gt;
 10 '''while''' ''Q'' &amp;amp;ne; &amp;amp;Oslash;&lt;br /&gt;
 11      ''u'' = DEQUEUE(''Q'')&lt;br /&gt;
 12      '''for''' each ''v'' &amp;amp;isin; ''G.Adj''[''u'']&lt;br /&gt;
 13              '''if''' ''v.color'' == WHITE&lt;br /&gt;
 14                       ''v.color'' = GRAY&lt;br /&gt;
 15                       ''v.d'' = ''u.d'' + 1&lt;br /&gt;
 16                       ''v''.&amp;amp;pi; = ''u''&lt;br /&gt;
 17                       ENQUEUE(''Q, v'')&lt;br /&gt;
 18      ''u.color'' = BLACK&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=251</id>
		<title>B-tree: insert</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=251"/>
		<updated>2014-09-25T16:07:41Z</updated>

		<summary type="html">&lt;p&gt;Lkw: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT(''T'', ''k'')&lt;br /&gt;
  1 ''r'' = ''T.root''&lt;br /&gt;
  2 '''if''' ''r.n'' == 2''t'' - 1&lt;br /&gt;
  3      ''s'' = ALLOCATE-NODE()&lt;br /&gt;
  4      ''T.root'' = ''s''&lt;br /&gt;
  5      ''s.leaf'' = FALSE&lt;br /&gt;
  6      ''s.n'' = 0&lt;br /&gt;
  7      ''s.c1111'' = ''r''&lt;br /&gt;
  8      B-TREE-SPLIT-CHILD(''s'', 1)&lt;br /&gt;
  9      B-TREE-INSERT-NONFULL(''s, k'')&lt;br /&gt;
 10 '''else''' B-TREE-INSERT-NONFULL(''r, k'')   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT-NONFULL(''x'', ''k'')&lt;br /&gt;
  1 ''i'' = ''x.n''&lt;br /&gt;
  2 '''if''' ''x.leaf''&lt;br /&gt;
  3      '''while''' ''i &amp;amp;ge; 1 and ''k'' &amp;lt; ''x.key''iiiii&lt;br /&gt;
  4              ''x.key''iii+111 = ''x.key''iiiii&lt;br /&gt;
  5              ''i'' = ''i'' - 1&lt;br /&gt;
  6      ''x.key''iii+111 = ''k''&lt;br /&gt;
  7      ''x.n'' = ''x.n'' + 1&lt;br /&gt;
  8      DISK-WRITE(''x)&lt;br /&gt;
  9 '''else while''' ''i'' &amp;amp;ge; 1 and ''k'' &amp;lt; ''x.key''iiiii&lt;br /&gt;
 10             ''i'' = ''i'' - 1&lt;br /&gt;
 11        ''i'' = ''i'' + 1&lt;br /&gt;
 12        DISK-READ(''x.c''iiii)&lt;br /&gt;
 13        '''if''' ''x.ciiii.n'' == 2''t'' - 1&lt;br /&gt;
 14               B-TREE-SPLIT-CHILD(''x, i'')&lt;br /&gt;
 15               '''if''' ''k'' &amp;gt; ''x.key''iiii&lt;br /&gt;
 16                       ''i'' = ''i'' + 1&lt;br /&gt;
 17         B-TREE-INSERT-NONFULL(''x.ciii, k)   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=249</id>
		<title>B-tree: insert</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=B-tree:_insert&amp;diff=249"/>
		<updated>2014-09-25T15:56:07Z</updated>

		<summary type="html">&lt;p&gt;Lkw: Created page with &amp;quot;&amp;lt;code&amp;gt;  B-TREE-INSERT(''T'', ''k'')   1 ''r'' = ''T.root''   2 '''if''' ''r.n'' == 2''t'' - 1   3      ''s'' = ALLOCATE-NODE()   4      ''T.root'' = ''s''   5      ''s.leaf''...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;code&amp;gt;&lt;br /&gt;
 B-TREE-INSERT(''T'', ''k'')&lt;br /&gt;
  1 ''r'' = ''T.root''&lt;br /&gt;
  2 '''if''' ''r.n'' == 2''t'' - 1&lt;br /&gt;
  3      ''s'' = ALLOCATE-NODE()&lt;br /&gt;
  4      ''T.root'' = ''s''&lt;br /&gt;
  5      ''s.leaf'' = FALSE&lt;br /&gt;
  6      ''s.n'' = 0&lt;br /&gt;
  7      ''s.c1111'' = ''r''&lt;br /&gt;
  8      B-TREE-SPLIT-CHILD(''s'', 1)&lt;br /&gt;
  9      B-TREE-INSERT-NONFULL(''s, k'')&lt;br /&gt;
 10 '''else''' B-TREE-INSERT-NONFULL(''r, k'')   &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Bubble_sort&amp;diff=248</id>
		<title>Bubble sort</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Bubble_sort&amp;diff=248"/>
		<updated>2014-09-25T15:32:54Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 BUBBLESORT(''A'')&lt;br /&gt;
 1 '''for''' ''i'' = 1 '''to''' &amp;quot;A.length&amp;quot; - 1 &lt;br /&gt;
 2      '''for''' ''j'' = ''A.length'' '''downto''' ''i'' + 1&lt;br /&gt;
 3            '''if''' ''A''[''j''] &amp;lt; ''A''[''j'' - 1]&lt;br /&gt;
 4                  exchange ''A''[''j''] with ''A''[''j'' - 1]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Bubble_sort&amp;diff=247</id>
		<title>Bubble sort</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Bubble_sort&amp;diff=247"/>
		<updated>2014-09-25T15:32:20Z</updated>

		<summary type="html">&lt;p&gt;Lkw: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pseudocode == &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 BUBBLESORT(''A'')&lt;br /&gt;
 1 '''for''' ''i'' = 1 '''to''' &amp;quot;A.length&amp;quot; - 1 &lt;br /&gt;
 2      '''for'' ''j'' = ''A.length'' '''downto''' ''i'' + 1&lt;br /&gt;
 3            '''if''' ''A''[''j''] &amp;lt; ''A''[''j'' - 1]&lt;br /&gt;
 4                  exchange ''A''[''j''] with ''A''[''j'' - 1]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lkw</name></author>
	</entry>
</feed>