Docsity

indexing and Multiways trees, Lecture notes of Data Structures and Algorithms

Partial preview of the text

Download indexing and Multiways trees and more Lecture notes Data Structures and Algorithms in PDF only on Docsity!

Unit 5

UNIT-

Indexing and Multiways

Trees

-Section 1-

Indexing, Indexing Techniques

Definitions

  • (^) Index: an auxiliary data structure to speed up record retrieval
  • (^) Search key : the field/s of a table which is/are indexed
  • (^) Storage: index files that contain index records
    • (^) Each entry storing
      • (^) Actual data record
      • (^) or, search key value k and record ID < k,rid>
      • (^) or, search key value k and list of records IDs < k,rid list> Page i Page i+ Paul Anna Tim

Indexing TechniquesCylinder Surface Indexing Techniques

Hash Indices

  • (^) Hashing can be used not only for file organization, but also for index-structure creation.
  • (^) A hash index organizes the search keys, with their associated record pointers, into a hash file structure.
  • (^) Strictly speaking, hash indices are always secondary indices ļ‚§ (^) if the file itself is organized using hashing, a separate primary hash index on it using the same search-key is unnecessary. ļ‚§ (^) However, we use the term hash index to refer to both secondary index structures and hash organized files.

Tree Indices

  • (^) In Tree Indexing for search a record from a data base then records are arranged in a tree like manner. Then using tree search technique the desired record present on disk can be accessed.
  • (^) For indexing purpose uses
    • (^) AVL
    • (^) B tree
    • (^) B+ Tree

Types of search tree

  • (^) Search tree is a tree data structure which

is used for locating specific key form a

given data set.

  • (^) Types:
    • (^) Binary Search Tree
    • (^) AVL Tree
    • (^) Multiway Trees
    • (^) Red Black Tree
    • (^) Splay Tree
    • (^) Trie Tree
    • (^) K-D Tree
    • (^) AA Tree

Multiway Search Tree

  • (^) An M-way search tree is either empty or satisfies following properties:
  1. Each node can hold maximum m-1 keys and can have maximum m children.
  2. A node with n children has n-1 values.
  3. The keys in a node are in ascending order.
  4. Keys in non leaf node will divide the left and right subtree where value of left sub tree keys will be less and value of right subtree keys will be more than that particular key.

Multiway Search Tree

ļ‚§ B Tree

ļ‚§ B+ Tree

Multiway Search Tree

Definition Of B-Tree

  • (^) Definition assumes external nodes (extended m-way search tree).
  • (^) B-tree of order m.
    • (^) All Leaf nodes are at the same level.
    • (^) All non leaf nodes(except root) should have at

least (m/2) children.

  • (^) Each leaf node should have at least (m/2)-

keys.

  • (^) Not empty => root has at least 2 children
  • (^) All non leaf node with n-1 key values should

have n non NULL children.

Insert 15 20 8 4 1 3 5 6 9 30 40

Insertion into a full leaf triggers bottom-up

node splitting pass.

16 17

Insert 15 20 8 4 1 3 5 6 9 30 40

  • (^) Insert a pair with key = 2.
  • (^) New pair goes into a 3-node. 16 17

Insert 15 20 8 4 1 3 5 6 9 30 40

  • (^) Insert a pair with key = 2. 16 17

Insert 15 20 8 4 5 6 9 30 40 16 17 3 1 2

  • (^) Insert a pair with key = 2 plus a pointer

into parent.