Presentation is loading. Please wait.

Presentation is loading. Please wait.

Index Structures Parin Shah Id:-207. Topics Introduction Structure of B-tree Features of B-tree Applications of B-trees Insertion into B-tree Deletion.

Similar presentations


Presentation on theme: "Index Structures Parin Shah Id:-207. Topics Introduction Structure of B-tree Features of B-tree Applications of B-trees Insertion into B-tree Deletion."— Presentation transcript:

1 Index Structures Parin Shah Id:-207

2 Topics Introduction Structure of B-tree Features of B-tree Applications of B-trees Insertion into B-tree Deletion from B-tree

3 B-Tree (Balanced-tree) A data structure used for organizing the indexes. In order to keep access time to a minimum, it stores the data keys in a balanced hierarchy that continually realigns itself as items are inserted and deleted. The tree is balanced, meaning that all paths from the root to a leaf have the same length.

4 Structure of B-tree Layer structure in B-tree can be divided into three categories: – Root – Intermediate nodes – Leaves Intermediate nodes can have depth more than 1

5 Structure of B-tree (contd…) Nodes in the b-tree are known as blocks. Each block consist of n search-key values and n + 1 pointers. The value of n is implementation dependant.

6 Example Suppose our blocks are 4096 bytes. Let keys be integers of 4 bytes and let pointers be 8 bytes. We want to find the largest integer value of n such that 4n + 8(n + 1) = 4096. That value is n = 340.

7 Features of B-tree The keys in leaf nodes are copies of keys from the data file. These keys are distributed among the leaves in sorted order, from left to right. At the root, there are at least two used pointers. All pointers point to B-tree blocks at the level below.

8 Features of B-tree At a leaf, the last pointer points to the next leaf block to the right, i.e., to the block with the next higher keys. Among the other n pointers in a leaf block, at least (n+1)/2 of these pointers are used and point to data records. Unused pointers may be thought of as null and do not point anywhere. The i th pointer, if it is used, points to a record with the i th key.

9 Applications of B-trees To perform a search for a single key on a set of one million keys (1,000,000), a linear search will require at most 1,000,000 comparisons. If the same data is indexed with a b-tree of minimum depth 10, 114 comparisons will be required in the worst case. Although other balanced tree structures can be used, a b-tree also optimizes costly disk accesses that are of concern when dealing with large data sets.

10 Applications of B-trees Like many other data structure B-tree can be used in multiuser environment. This can be done by the use of different types of locking mechanisms.

11 Thank You.


Download ppt "Index Structures Parin Shah Id:-207. Topics Introduction Structure of B-tree Features of B-tree Applications of B-trees Insertion into B-tree Deletion."

Similar presentations


Ads by Google