B-tree: minimum: Difference between revisions

From Algowiki
Jump to navigation Jump to search
m (Luedecke moved page B-Tree:Minimum to B-tree: minimum)
m (→‎Pseudocode: Notation angepasst)
Line 20: Line 20:
  Minimum(''x'')
  Minimum(''x'')
  1 '''while''' leaf(''x'') = false
  1 '''while''' leaf(''x'') = false
  2        ''x'' = c_1(''x'')
  2        ''x'' = c_0(''x'')
  3 '''return''' key_1(''x'')
  3 '''return''' key_0(''x'')
</code>
</code>

Revision as of 11:21, 13 October 2014

General Information

Algorithmic Problem:

Type of algorithm: loop

Auxiliary data: A pointer p of type "pointer to a B-tree node".

Abstract View

Invariant: Before and after each iteration:

  1. p points to some node N of the B-tree.

Variant: p is redirected from the current node N to the first child of the current node.

Break condition:

  1. p points to a leaf of the B-tree.

Pseudocode

Minimum(x)
1 while leaf(x) = false
2        x = c_0(x)
3 return key_0(x)