• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B+ Tree in Java

 
Ganesh Pat
Ranch Hand
Posts: 79
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 49379
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 79
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ 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.
b+.JPG
[Thumbnail for b+.JPG]
This is algorithm want to develop in java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic