Pregunta de entrevista de SAP

What is B Tree and B+ tree and what are the difference?

Respuesta de la entrevista

Anónimo

23 sep 2011

A B-tree is a tree data structure that keeps data sorted and allows searches, sequential access, insertions, and deletions in logarithmic amortized time. The B-tree is a generalization of a binary search tree in that a node can have more than two children. A B+ tree or B plus tree is a type of tree which represents sorted data in a way that allows for efficient insertion, retrieval and removal of records, each of which is identified by a key. It is a dynamic, multilevel index, with maximum and minimum bounds on the number of keys in each index segment (usually called a "block" or "node"). In a B+ tree, in contrast to a B-tree, all records are stored at the leaf level of the tree; only keys are stored in interior nodes. Advantages of B+-trees:1) Any record can be fetched in equal number of disk accesses.2) Range queries can be performed easily as leaves are linked up3) Height of the tree is less as only keys are used for indexing4) Supports both random and sequential access .Disadvantages of B+-trees:Insert and delete operations are complicatedRoot node becomes a hotspot

1