File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes B+ Tree in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "B+ Tree in Java" Watch "B+ Tree in Java" New topic

B+ Tree in Java

Ganesh Pat
Ranch Hand

Joined: Feb 04, 2012
Posts: 79

hi friends, I want to fetch data of items from database and display it by price in ascending form in form of B+ Tree so please tell me should I use array or arraylist or vector for that ? I did binary tree in data structure but dunno how to do in java please need help....
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46437
I think you need to learn lots more about the collections framework. The first thing which sprang to mind was a sorted set. Remember that sets do not support duplicate values, so you cannot add two values which return 0 from the compareTo method or compare method of their Comparator.
Ganesh Pat
Ranch Hand

Joined: Feb 04, 2012
Posts: 79

@ Cambell no i also want duplicate values to be added in tree. The main problem is that the root node can have more than one node attached to it. Generally in binary tree or in any tree we have max 2 nodes from root node i.e left and right node and further nodes get added next to left or right node of root node but this is not the case here. Here root node which can have more than 2 nodes . I have attached a picture of that tree example if possible please have look at it.

[Thumbnail for b+.JPG]

I agree. Here's the link:
subject: B+ Tree in Java
It's not a secret anymore!