Creating Database using B+Tree in Java

Creating Database using B+Tree in Java

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









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
Creating database using DBCP
;Enter Database name:"); String database = bf.readLine(); st.executeUpdate("CREATE DATABASE " + database); System.out.println("1 row(s
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
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 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 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 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 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 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
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
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
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 PDF in JAVA
Creating PDF in JAVA  How create pdf in java ? Take value from database for particular PDF
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
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
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.... In this search engine our application communicate with database using
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:ADS_TO_REPLACE_1 Insert data into database Thanks
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
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
Creating a memory leak with Java
Creating a memory leak with Java  Creating a memory leak with Java
creating list in dropdown using struts - Struts
creating list in dropdown using struts   creating list in dropdown using struts : In action class list.add(new LabelValueBean("ID","Name")); In Jsp * Select Item Select In Form : getter
Creating a web service that connects to the database - WebSevices
Creating a web service that connects to the database  Hello, Good... be achieved especially the creation of accounts and then saving to the database. Am using netbeans 6.1 with glassfish as my application server. Am
Android using database
Android using database  How to Add,delete,modify the contact name,address,phone no into the database using android coding
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
using database - Development process
using database  i want to ask f we developed off line application then which database will be best for those application
creating and executing stored procedure using hibernate
creating and executing stored procedure using hibernate  I have to execute following query using hibernate DECLARE @i_STARTDATETIME DATETIME DECLARE @i_ENDDATETIME DATETIME DECLARE @o_ERRORCODE INT DECLARE @o_ERRORDESCRIPTION
Accessing Database using EJB
Accessing Database using EJB       This is a simple EJB Application that access the database. Just go... Database. Creating a simple Database driven application in EJB 1)Create
Creating a database
Creating database At first create a database in MySql database named studentadmissionprocess then create a table stud_admission as Use the SQL code to create table stud_admission stud_admission CREATE TABLE stud_admission
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
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
database connectivity using mysql
database connectivity using mysql  java file: eg1.java package eg; import java.sql.*; public class eg1 { public static void main(String arg... seconds) I am using Netbeans 5.5, mysql server 5.0, to get data from table
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
how to backup and restore database using java - Swing AWT
how to backup and restore database using java  sir my project is to backup and restore my datas using java so i want to know how to backup and restore databases using java give ur ideas and suggestions to me immediately  
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
How to Open Picture From M.S. Access Database using Java Servlet ?
How to Open Picture From M.S. Access Database using Java Servlet ?  ... Database But i m still not able to open this picture through Java using M.S. Access and i wants to open this Picture On Web Browser using Java Servlet anybody can
Creating List in Java using SWT
Creating List in Java using SWT   ... of certain items using the Standard Widget Toolkit In this example, we have create a list of certain items using SWT that provides the class List of package
Creating Auto Shape in PowerPoint Using Java
Creating Auto Shape in PowerPoint Using Java... to create auto shape on PowerPoint slide using java. In this example, we are creating the object of AutoShape .We are passing the shape type into AutoShape
Creating a MySQL Database Table to store Java Types
Creating a MySQL Database Table to store Java Types... to store a java types in our database table. Now one question may arise in your... to create a table in MySQL database that stores all java types. Here we
Database programming - Java Beginners
Database programming  How to do a Database programing with Balanced Multiway Tree(B+ Tree,not Binary Tree) in java
what is the mysql in the database using php
what is the mysql in the database using php  what is the mysql in the database using php  Please visit the following link: PHP Database
what is the mysql in the database using php
what is the mysql in the database using php  what is the mysql in the database using php  Please visit the following link: PHP Database
sending data to google chart api from mysql database using java
sending data to google chart api from mysql database using java  Äîáîâëÿéòåñü â ãðóïïó "ÌÀÉÍÊÐÀÔÒÀ" Áóäüòå ó÷àñòíèêàìè Ãðóïïû Ïîìîãàèòå íàì è ñåáå Íàøà ãðóïïà https://vk.com/club60851464 Åñòü ñâîé ñåðâåð! Õîðîøàÿ àòìîñôåðà
creating reports in java
creating reports in java  how to create reports automatically in java and send it via mail by scheduling tine for weekly,monthly basis
importing CSV data into Database in java when the no of columns are known using javacsv
importing CSV data into Database in java when the no of columns are known using javacsv   I have imported CSV data into postgres Database in java using javaCSV jar. But now i have to convert it in such way

Ads