GATE CSE
First time here? Checkout the FAQ!
x
0 votes
41 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 (10.6k points)   | 41 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 Active (1.7k 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)

Related questions

Top Users Jan 2017
  1. Debashish Deka

    9660 Points

  2. sudsho

    5554 Points

  3. Bikram

    5270 Points

  4. Habibkhan

    4878 Points

  5. Vijay Thakur

    4498 Points

  6. Arjun

    4418 Points

  7. saurabh rai

    4236 Points

  8. Sushant Gokhale

    4140 Points

  9. Kapil

    3848 Points

  10. santhoshdevulapally

    3808 Points

Monthly Topper: Rs. 500 gift card

19,443 questions
24,221 answers
53,870 comments
20,372 users