in Databases
2,602 views
0 votes
0 votes
if we use 3 key ,4 pointer nodes. how many different B tree are there when the data file has 6 records.?? ...kindly explain with a descriptive figure
in Databases
2.6k views

1 comment

only one
0
0

1 Answer

0 votes
0 votes

structure of b-tree

b-tree node structure
p1 key1, data recordpointer p2


in this p = child pointer ....///key=keys....///record = data record pointer
note:- every node has same structure whether it is root,internal,leaf...but in leaf node child pointers r null,
now order of b-tree is maximum no. of child pointers a node can have .
lets say 'p' is order
order of root = min. 2  to max. 'p'.....///// keys/record pointers= 1 to p-1
  .........internal = min ceil p/2 to p/////keys/record pointers= ceil (p-1)/2 to m-1
 leaf ==null child pointers/////keys/record pointers= ceil (p-1)/2 to  p-1.
keys = record pointers for any node.
any node in b-tree has data record pointers 
note :- all leaf nodes are at same level in b-tree considered in DBMS for indexing..
we cannot disribute 6 records in all nodes..
here we have to disribute them only in leaf nodes..

there are only 2 ways to disribute...given below 

4 pointer node..3 key....doesn't mean that every node  should be completely filled..//root can have record or cannot have record it is not necessary in btree

root can have min..2 child pointers and 1 key..max- 4 child here

leaf can have minimum..2 keys& records.. and maximum 3 keys and records///child pointers are zero in leaf node..

edited by

4 Comments

srestha....i earlier mentioned in answer" we cannot disribute 6 records in all nodes." b-tree cannot be drawn for this specification 3 keys 4 pointers 6 records...////here these 6 records are distributed in only leaf nodes.....in root and other internal nodes ....there may be some other keys...and level may also increase.../////and you are saying if we have 3 records in root ..then we are left with only 3 records for leaf...coz total 6 records...now 3 records cannot be...distributed among leaf nodes in any way if put 1 ,1,1...then minimum key &record property fails= minimum 2 key&records shud be there if u put all three records in one leaf node then...all leaf level shud b at same level...this property fails"....i guess u understood...this question only suits well for B+ tree not b-tree
0
0
akriti u can check now...i have updated a figure..and u can ask ur question..
0
0
why is K1 in the root node not pointing to the record?? It is B-tree and not B+ tree, so we should have key-data pointer pair.
0
0