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
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
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 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
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 
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 PDF in JAVA
Creating PDF in JAVA  How create pdf in java ? Take value from database for particular PDF
Creating a memory leak with Java
Creating a memory leak with Java  Creating a memory leak with Java
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 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 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
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
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
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
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 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
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
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
creating JAR - Java Beginners
creating JAR  I am beginner in J2ee.I am creating an application... installed SQL and Tomcat.I created a JAR of my java project and included in the library of web project. My problems 1. I added new class in the java project
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
creating Xml - Java Beginners
creating Xml  how we can create a xml file using java Creating XML File is possible in java with this packages. import... this Elemnts to DOcumnet object. Creating XML File is possible  Creating XML File is possible
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
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
Tutorials   
Java Spring Hibernate Struts Training ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java

Ads

 
Advertisement null

Ads