tags:

views:

98

answers:

1

What data structure should I use to implement a BTree? Why?

+1  A: 

Hi,

You can create a btree node using following class.. it is having 7 keys and 8 pointers. u can change it according to the definition of btree node and perform operations on it

class BTNode
{
   BTNode pointers[];
   String keys[];
   int numKeys;
   boolean leaf;

   public BTNode()  // constructor to initialize values
   {
     leaf=true;
     numKeys=0;
     keys=new String[7];
     pointers=new BTNode[8];
   }
}
rohit