From c4f17674cfa0aef127a0418c0375da4109c856c6 Mon Sep 17 00:00:00 2001 From: Harshit Omer <20610736+omerharshit@users.noreply.github.com> Date: Mon, 13 May 2019 03:49:23 +0530 Subject: [PATCH] Adding Time Analysis for B-Trees (#31013) * Adding Time Analysis for B-Trees Time Analysis for B-Tree: Suppose a B-tree has n elements and M is the maximum number of children a node can have. What is the maximum depth the tree could have? What is the minimum depth the tree could have? The worst-case depth (maximum depth) of a B-tree is: logM/2 n. The best-case depth (minimum depth) of a B-tree is: logM n. Worst-Case Times for B-Trees: Adding or removing an element in a B-tree with n elements is O(log n). * fix: removed duplicate info --- guide/english/algorithms/b-trees/index.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/guide/english/algorithms/b-trees/index.md b/guide/english/algorithms/b-trees/index.md index 38c4261630..69f1152e91 100644 --- a/guide/english/algorithms/b-trees/index.md +++ b/guide/english/algorithms/b-trees/index.md @@ -25,3 +25,10 @@ Traversal is also similar to Inorder traversal of Binary Tree. We start from the Insertion: We insert into the bottom of a B-tree, similar to binary search trees. First, find an appropriate place at the bottom of the tree to insert a given key, and perform the insertion (also adding an additional empty child). If the node is too big (it has m keys and m + 1 (empty) children), split the node. + +Time Analysis for B-Tree: + +Suppose a B-tree has n elements and M is the maximum number of children a node can have. What is the maximum depth the tree could have? What is the minimum depth the tree could have? + +- The worst-case depth (maximum depth) of a B-tree is: logM/2 n. +- The best-case depth (minimum depth) of a B-tree is: logM n.