The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
89 views
between B trees and B+ trees,which one is suited for random and which one is suited for sequential access??

please explain
asked in Databases by Veteran (14.8k points) | 89 views

1 Answer

+1 vote
Best answer
Both B and B+ trees are pratical implementations of sorted file organisation. I am not sure what you mean by sequential access. But as the records are sorted they can be accessed in sequence. And in B+ trees all leaf nodes are linked and they contain all index key values and record pointers. Hence they are perfect for range queries. for eg where salary between 1000000 and 200000.

For quick random access on the other hashed file organisation is best suited.
answered by Loyal (4.6k points)
selected by
In B+ trees, if the searching is done on the element(s) that are indexed using B+ tree, B+ tree definitely gives better performance.

Else, its difficult to compare.
Also, hasing may give bad performance as compared to B trees. Depends upon how hashing is implemented i.e. chaining may give as good performance as B trees.
If the hashing algorithm used uniformly distributes the data such that minimal conflicts occurs then the elements can be accessed in O(1). And chaining is used to resolve conflicts in hashing. Dynamic and extensible hashing enables the hash bucket to grow dynamically eliminating conflict all together. So hashed file organisation is best suited for random access.
is it practically possible to distribute uniformly? I mean I am just asking :) . Yes, but atleast therotically, its O(1)


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

28,831 questions
36,676 answers
90,577 comments
34,638 users