GATE CSE
First time here? Checkout the FAQ!
x
0 votes
68 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 (13.2k points)   | 68 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 Jul 2017
  1. Bikram

    5784 Points

  2. manu00x

    3602 Points

  3. Arjun

    1988 Points

  4. Debashish Deka

    1924 Points

  5. joshi_nitish

    1908 Points

  6. pawan kumarln

    1680 Points

  7. Tesla!

    1426 Points

  8. Hemant Parihar

    1334 Points

  9. Shubhanshu

    1180 Points

  10. Arnab Bhadra

    1124 Points


24,169 questions
31,187 answers
71,040 comments
29,512 users