Click here to Skip to main content
15,906,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
For Implementation of B trees what data structure should I use to store the key values ? Should I use array of int type , Integer type or maybe linked list or something else .

What I have tried:

I am implementing code for B trees in Java .
Posted
Updated 21-Apr-18 20:20pm
Comments
[no name] 21-Apr-18 19:11pm    
B tree cries for linked list, at least for me.
Member 13616463 22-Apr-18 3:10am    
If the BTree is itself stored on the disk then a linked list will make it very complicated to maintain.

1 solution

Key values are usually stored within the b-tree structure in the leaf nodes.

Values for keys may be stored in the b-tree, but usually you would store them elsewhere and have leaf node "Key/Value"->"Key/pointer" point to another structure if the values are large (byte wise).

The actual "key/value" or "key/pointers" are usually stored in an array or list, depending on the functionality you want to have while searching, inserting and moving data around in the leaf nodes.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900