08-11-2012, 05:16 PM
Indexing
1Indexing.ppt (Size: 568 KB / Downloads: 44)
Terms(1)
Entry sequenced file: Order records by time of insertion.
Search with sequential search
Index file: Organized, stores pointers to actual records.
Could be organized with a tree or other data structure.
Primary Key: A unique identifier for records. May be inconvenient for search.
Secondary Key: An alternate search key, often not unique for each record. Often used for search key.
Tree Indexing (1)
Linear index is poor for insertion/deletion.
Tree index can efficiently support all desired operations:
Insert/delete
Multiple search keys (multiple indices)
Key range search
2-3 Tree (1)
A 2-3 Tree has the following properties:
A node contains one or two keys
Every internal node has either two children (if it contains one key) or three children (if it contains two keys).
All leaves are at the same level in the tree, so the tree is always height balanced.
The 2-3 Tree has a search tree property analogous to the BST.
B-Tree Definition
A B-Tree of order m has these properties:
The root is either a leaf or has at least two children.
Each node, except for the root and the leaves, has between m/2 and m children.
All leaves are at the same level in the tree, so the tree is always height balanced.
A B-Tree node is usually selected to match the size of a disk block.
A B-Tree node could have hundreds of children.