Tutorial 1.0
24 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
24 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

B+ Tree and Hashing B+ Tree Properties B+ Tree Searching B+ Tree Insertion B+ Tree Deletion Static Hashing Extendable Hashing Questions in pass papersB+ Tree PropertiesB+ Tree Properties– Balanced Tree Same height for paths from root to leaf Given a search-key K, nearly same access timefor different K values– B+ Tree is constructed by parameter n Each Node (except root) has n/2 to n pointers Each Node (except root) has n/2-1 to n-1search-key valuesGeneral case for nCase for n=3K K K K K1 2 1 2 n-1P P1 P P 1 P P P2 3 2 n-1 nB+ Tree PropertiesTutorial 8.1 Search keys are sorted in order– K < K < … =K2 3i i i-1Key values in S < K1 1S S S1 2 3K <= Key values in S < K1 2 2Leaf NodeP3K K …1 2P–P points record or bucket with1Pi2search key value KRecord of K Record of Ki1 2–P points to the neighbor leafRecord of Kn 2node…B+ Tree SearchingTutorial 8.2 Given a search-value k– Start from the root, look for the largest search-key value (K ) in the node <= kl– Follow pointer P to next level, until reach al+1K <=k

Informations

Publié par
Nombre de lectures 12
Langue English

Extrait

B+
Tree
and
Hashin
B+
B+
B+
B+
Tree
Tree
Tree
Tree
Properties
Searching
Insertion
Deletion
Static Hashing
Extendable Hashing
Questions in pass papers
B+ Tree Properties B+ Tree Properties
– Balanced Tree • Same height for paths from root to leaf • Given a search-key K, nearly same access time for different K values – B+ Tree is constructed by parametern • Each Node (except root) hasn/2to n pointers • Each Node (except root) hasn/2-1 to n-1 search-key values Case for n=3 General case for n K1K2K1K2 P1P2P3P1P2
Kn-1
Pn-1Pn
B+ Tree PropertiesTutorial 8.1
• Search keys are sorted in order – K1< K2< … <Kn-1 •Non-leaf Node Each ke -search values in subtreeSiK1K2 pointedbyyPi< Ki, >=Ki-1P1P2P3 K1vylaeKlavyiseuSnsiuenSKe<=12<<KK12S1S2S3 •Leaf Node –Pipoints record or bucket withP1K1P2KP3search key value Ki Record of K1Record of K2 –Pnpoints to the neighbor leafRecord of K2 node
B+ Tree SearchingTutorial 8.2
Given a search-value k – Start from the root, look for thelargestsearch-key value (Kl) in the node <= k – Follow pointer Pl+1to next level, until reach a leaf nodeKl<=k<K l+1 K1K2… KlKl+1 n-1 P1P2P3Pl+1P Pn – If k is found to be equal to Klin the leaf, follow Plto search the record or bucket KlKl+1 lPlk = Kl Record of Kl
RecodrofK
B+ Tree InsertionTutorial 8.3
• Overflow – When number of search-key values exceed n-1 7 9 13 15Insert 8
–Leaf Node •Split into two nodes: –1stnode contains(n-1)/2values –2ndnode contains remaining values –Copy the smallest search-key value of the 2ndnode to parent node
9
7 8
9 13 15
B+ Tree InsertionTutorial 8.3
• Overflow – When number of search-key values exceed n-1 7 9 13 15Insert 8 –Non-Leaf Node •Split into two nodes: –1stnode containsn/2-1 values –Move the smallest of the remaining values, together with pointer, to the parent –2ndnode contains the remaining values 9
7 8
13 15
B+ Tree InsertionTutorial 8.3
Example 1: Construct a B+tree for (1, 4, 7, 10, 17, 21, 31, 25, 19, 20, 28, 42) with n=4 .
1
1
4 7
4
7
17
1
7 10
4
7
7 10
17 21
1
B+ Tree Insertion
1
4
• 1, 4, 7, 10, 17, 21, 31, 25, 19, 20, 28, 42
4
7 17 25
7
7 10
7
10
17
17
19
17 21
20 25
20 21
25
31
25
31
1
B+ Tree InsertionTutorial 8.3
• 1, 4, 7, 10, 17, 21, 31, 25, 19, 20, 28, 42
4
7
10
7
17
17
19
20
21
20
25
31
25 28
31
42
B+ Tree InsertionTutorial 8.3
• Example 2: n=3, insert 4 into the following B+Tree9 10
2
4
7
45
9
A
2 5
B
0
C
7
8
Leaf A
D
Subtree C
Leaf B
Subtree D
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents