Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

Creating Database using B+Tree in Java

Ads

 
 

Share on Google+Share on Google+

Arnab Sarkar
Creating Database using B+Tree in Java
1 Answer(s)      8 years ago
Posted in : Java Beginners
Ads
View Answers

January 19, 2009 at 12:35 AM


Hi friend,

Code to help in solving the problem :


public class BinarytreeInsert {

public static void main(String[] args) {
new BinarytreeInsert().run();
}

static class Node {

Node left;
Node right;
int value;

public Node(int value) {
this.value = value;
}
}

public void run() {
Node rootnode = new Node(25);
System.out.println("Building tree with root value " + rootnode.value);
System.out.println("=================================");
insert(rootnode, 11);
insert(rootnode, 15);
insert(rootnode, 16);
insert(rootnode, 23);
insert(rootnode, 79);

}


public void insert(Node node, int value) {
if (value < node.value) {
if (node.left != null) {
insert(node.left, value);
} else {
System.out.println(" Inserted " + value + " to left of Node " + node.value);
node.left = new Node(value);
}
} else if (value > node.value) {
if (node.right != null) {
insert(node.right, value);
} else {
System.out.println(" Inserted " + value + " to right of Node " + node.value);
node.right = new Node(value);
}
}
}
}

Thanks

Ads









Related Tutorials/Questions & Answers:
Creating Database using B+Tree in Java - Java Beginners
Creating Database using B+Tree in Java  I'm doing a project in which I have to create an Object Oriented Database using B+Tree in Java..It is not a Database connectivity..I have to create a seperate Database(like Oeacle)my-self
B+ tree - Java Beginners
. In this assignment, you will implement B+-tree data structure on a fixed-length data... field is separated or delimited by a white space. Initially, your B+-tree... user interface (GUI). Your GUI also visualizes B+tree structure after executing any
Advertisements
B+tree lodaing - Java Beginners
B+tree lodaing  hi, i have fixed-length data file such student table. All fields are fixed length: 8 for number (20022509), 3 for name (PIS), 4... or delimited by a white space. how i can Initially, constructed B+ tree based
B+ tree JAVA source code for implementing Insertion and Deletion - Java Beginners
B+ tree JAVA source code for implementing Insertion and Deletion  Can anyone plz mail de B+ tree JAVA source code for implementing Insertion...().Start()); } } class BTreeDemo { public int Start(){ Tree
initializing B+ tree from Jtable - JDBC
initializing B+ tree from Jtable   hi, i have fixed-length data file such student table.i stored this file in Jtable All fields are fixed length: 8... i can Initially, constructed B+ tree based from this Jtable. and make initial
Creating database using DBCP
;Enter Database name:"); String database = bf.readLine(); st.executeUpdate("CREATE DATABASE " + database); System.out.println("1 row(s
Database programming - Java Beginners
Database programming  How to do a Database programing with Balanced Multiway Tree(B+ Tree,not Binary Tree) in java
database connection by using java bean
database connection by using java bean  i need a code for bean class to connect to mysql database. subsequently to use dis bean class whereever i need 2 connect 2 database
Creating an Encyclopedia using Java & mySQL 5 - Java Beginners
Creating an Encyclopedia using Java & mySQL 5  Dear Editor, I'm very impressed of your Java tutorial website. I'm take up advance JAva... database. Source code using NetBeans: private void
Creating Database - SQL
ciao.co.uk. we are creating the database in mysql. 1> category->subcategory->...Creating Database  Hi I am Guru I am having the confusion in creating the database.Actually Just I joined one small company. I am
creating trafficsignal using thread
creating trafficsignal using thread  please give me code how to create trafic signal using thread and give me it to my email [email protected] thanks
Creating Trapezoid Using Java
Creating Trapezoid Using Java   ... on PowerPoint slide using java. In this example, we are creating a slide master... are using setAnchor() method. To set the color we are using setFillColor(Color.Red
How sql Queries possible in DAO without creating Database connections - Java Beginners
How sql Queries possible in DAO without creating Database connections  In DAO we are writting sql queries , how it is possible without creating and closing database connections
Creating Database Tables and Indexes
Creating Database Tables and Indexes   ... the allowable syntax for identifiers in MySQL. The identifiers are Database, table, index...; Database 64 table 64 column 64 Index 
Creating PDF in JAVA
Creating PDF in JAVA  How create pdf in java ? Take value from database for particular PDF
database backup and restore using java - JDBC
database backup and restore using java  Hi... I have MS Access 2000 database.I want to backup and restore the db using jdbc.What's the procedure for that. Thanks in advance
Using database - Java Server Faces Questions
Using database  Sorry,Actually I ant the project to register the personl details using mysql database and access by loging the user name and password in jsf,can you send me please?  My dear, You go the following url
using a database to upload items - Java Beginners
using a database to upload items  I need to create a database... is my code and the items i need in a database import javax.swing.*; import... for the event-dispatching thread: //creating and showing this application's GUI
Creating a Database in MySQL
Creating a Database in MySQL       After establishing the connection with MySQL database by using... of some java methods and SQL statement. A RDBMS (Relational Database Management System
Creating a memory leak with Java
Creating a memory leak with Java  Creating a memory leak with Java
sending data to google chart api from mysql database using java
sending data to google chart api from mysql database using java  how to send data from mysql database to google chart api using java
Connecting to the Database Using JDBC and Pure Java driver
Connecting to the Database JDBC Driver In our search engine we are using MySQL database server and MM.MySQL Driver... engine our application communicate with database using JDBC
how to creating hbm files in hibernate using Myeclipse
how to creating hbm files in hibernate using Myeclipse  how to creating hbm files in hibernate using Myeclipse
Creating Composite Widgets using GWT
Creating Composite Widgets using GWT       This example describes the Basics for creating composite widgets using GWT. The steps involved in Building the Composite
creating java classes
creating java classes  Create a Java class that can be used to store inventory information about a book. Your class should store the book title... a program that tests your class by creating and using at least two objects of the class
database entry using jdbc
database entry using jdbc  Give me a program to enter records in table using jdbc in java.   Hi Friend, Please visit the following link: Insert data into database Thanks
How to insert dynamic textbox values into database using Java?
How to insert dynamic textbox values into database using Java?  Hi I am trying to insert dynamic textbox values to database, my jsp form have 2... these dynamic textbox values to database(Oracle 11g)...Please help me out. I have
While creating a jar how to add MySQL database to project
While creating a jar how to add MySQL database to project  Hi, Please tell me how to attach MySQL database to the Java project while building a jar or their is any other process
Mini project on Book Bank using netbeans tool with java and for database using mysql
Mini project on Book Bank using netbeans tool with java and for database using mysql  hi roseindia, i have need the miniproject on bookbank with the deisgn using the netbeans tool, and create the database for that using mysql
Mini project on Book Bank using netbeans tool with java and for database using mysql
Mini project on Book Bank using netbeans tool with java and for database using mysql  hi roseindia, i have need the miniproject on bookbank with the deisgn using the netbeans tool, and create the database for that using mysql
Creating URL in java
Creating URL in java  Hii to all I m trying to create a url using java. Address is http://www.merchant.com/pg/index.html When i m going to run...[] args) { try { // // Creating