First time here? Checkout the FAQ!
0 votes
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 (13.1k points)   | 64 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 (3.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)

Top Users May 2017
  1. akash.dinkar12

    3598 Points

  2. pawan kumarln

    2314 Points

  3. Bikram

    1958 Points

  4. Arjun

    1942 Points

  5. sh!va

    1682 Points

  6. Debashish Deka

    1296 Points

  7. Devshree Dubey

    1282 Points

  8. Arunav Khare

    1122 Points

  9. Angkit

    1072 Points

  10. LeenSharma

    1028 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 29 - Jun 04
  1. Arjun

    292 Points

  2. Arunav Khare

    246 Points

  3. Arnab Bhadra

    122 Points

  4. Rupendra Choudhary

    116 Points

  5. pC

    110 Points

22,912 questions
29,254 answers
27,750 users