B-Trees: Definition, Insertion, and Deletion Algorithms, Study notes of Data Structures and Algorithms

The definition of b-trees and explains the insertion and deletion algorithms. A b-tree is a self-balancing tree data structure that maintains sorted data and supports efficient search, insertion, and deletion operations. The tree has properties such as each non-empty node having between ⌈m and m children, and all keys in a node being ordered. The document also includes the pseudocode for insertion and deletion functions.

Typology: Study notes

Pre 2010

Uploaded on 07/30/2009

koofers-user-vx6-1
koofers-user-vx6-1 🇺🇸

4

(1)

9 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Data Structures and Algorithms, Week 08, Lecture 1 1
1 B-Trees, Definition
Definition. Suppose mis a positive integer. Then a B-tree of order m
is a tree with the following properties.
1. Each nonempty node other than the root has between dm
2eand m
children.
2. If the tree is nonempty, the root has between 2 and mchildren.
3. If a node has cchildren then it stores c1 keys in increasing
order.
4. If the keys stored in a node are
k1< k2<· · · < ks,
then
(a) all keys stored in leftmost or 0th subtree are less than k1,
(b) all keys stored in the ith subtree, 1 i < s, lie between ki
and ki+1,
(c) and all keys stored in the last subtree are greater than than
ks.
5. All the leaves have the same depth.
pf3

Partial preview of the text

Download B-Trees: Definition, Insertion, and Deletion Algorithms and more Study notes Data Structures and Algorithms in PDF only on Docsity!

1 B-Trees, Definition

  • Definition. Suppose m is a positive integer. Then a B-tree of order m is a tree with the following properties. 1. Each nonempty node other than the root has between dm 2 e and m children. 2. If the tree is nonempty, the root has between 2 and m children. 3. If a node has c children then it stores c − 1 keys in increasing order. 4. If the keys stored in a node are

k 1 < k 2 < · · · < ks,

then (a) all keys stored in leftmost or 0th subtree are less than k 1 , (b) all keys stored in the ith subtree, 1 ≤ i < s, lie between ki and ki+1, (c) and all keys stored in the last subtree are greater than than ks.

  1. All the leaves have the same depth.

// insert search current node for key; if (found) { print message; return null; } else if (current node is a leaf) { insert key into current node; } else { recursively insert into appropriate child of current node, possibly returning a new key and a new child; if (return is not null) { insert new key into current node; set reference to new child; } }

if (current node has too many children) { split the current node, creating a new key and a new child; return the key and child; } else { return null; }