What Tree Data Structures does Java Include?

Hello,
I have been reading about several tree data structures like a binary search tree, self-balancing bst, minimum spanning tree, red-black tree, AVL tree, etc... Are there data structures in Java represent the various trees, or is implementation of the ds left to user?
Eric

"Java" can be termed the "Java Language". The language does not have trees.
In more general usage "Java" can refer to a standard, desktop, delivered VM which includes the standard Java API. The types that you are asking about would be found in the following package.
[http://java.sun.com/javase/6/docs/api/java/util/package-summary.html]
"Java" could also refer to any other commonly available implementations. In that case probably anything that can be implemented has been implemented somewhere. Googling works.

Similar Messages

  • Trees Data Structures in Java

    Hi all !
    Currently I�m developing a Java software that requires a Tree data structure. Searching through Java API I�ve found classes like TreeMap and TreeSet, but although these classes seens to use tree structure behind what they really provide are linear data structure, not a tree data structure. My question is if there is a public and free Java tree data structure that permits to do activities such as:
    - Search for a particular node (efficiently)
    - Insert children to any node
    - Maintain one Object in each node
    Simple like this ! It must have something like this in Java, but I just can�t find it and I�m just too lazy to implement it :) ! Anyone can help me ?
    Thanks in advance !

    Mel,
    I�ve seen javax.swing.tree.TreeModel and its seens more like an implementation of Control in swing MVC (Model Vision Control) swing paradigm for JTree. It has listeners generated for manipulation events for example. It uses javax.swing.tree.DefaultMutableTreeNode for its nodes, and maybe I could use this class for the nodes of my tree since it has many useful operations. However still I miss a node searching operation that this class doesn�t have.
    Yes my problem is a simple Tree, but it is simple now and it might become much more complex, demanding more operations on the tree and specially efficient searching algorithms. Thats why I�m looking for a complete solution and I prefer something that is already done and well tested :) !
    Thanks for your tip !

  • 3750x Stack UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree

    A Cisco Stack 3750X switch report the following error message:
    %UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree.
    every minute +-20 sec
    Cisco IOS Software, C3750E Software (C3750E-IPBASEK9-M), Version 15.0(2)SE4, RELEASE SOFTWARE (fc1)
    analog bug: https://tools.cisco.com/bugsearch/bug/CSCsz93221

    WS-C3750G-24PS-E C3750-IPBASEK9-M version 12.2(53)SE2
    After implementing 802.1x with Avaya IP phones
    %UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree
    Port then fails authentication and goes into vl-err-dis

  • Is there a Java API for Tree data structure?

    Hi,
    I am wondering is there any Java API to work on Tree based data structure.
    I could read in some forums / sites that teach me how to create tree based objects using collection.
    But I wanted to know is there any core java API that can be used directly for tree based operations. (like binary tree or other type of trees)
    Please comment on this doubt.

    Headed using google and other stuff not found one.
    Suggestion: Why not start building the one, its a good idea to do that, isn't it.

  • Tree   Data  Structure

    Hello Guys,
    I am stuck in my project for a while and decided to contact you guys for ideas because am short of ideas how to get it done. This is the task: I have information like this from the server and have to create a tree structure from the information(data). The data from the server comes in this form:
    APP               net       main
    Account        net      main
    Address        net      main
    Person        net      OptelClient3
    Person        net      ggggg
    Person        net      show
    Bindings    apple    parse
    Bindings    apple    findProject
    Bindings    apple    show
    The positions of the columns is not fixed. The first column can become the second or the third depending on the preference of the user.
    1)
    The task is this:
    In each row , the first data must be the parent of the second data, the second data must be the parent of the third data and if there appears to be a fourth data then it will be the child of the third and it follows like that......
    I have to be able to build this tree structure whiles am looping over the information from the server.
    *****Optional Requirement****
    And if it is possible i must also be able to use the structure to create a table.
    I have spent much time(weeks after weeks) doing it but its not working so am asking if someone can help me with ideas how to get this done or point me to a tutorial where i can have a deep understanding of how i can do it.
    Thank for your help.

    Thanks for your reply.
    I have to implement the tree from the list i receive from the server. Each column belongs to the same class. For instance the first column will belong to a class called say "cHuman" and i will set the name attribute of each class to the names of the first column.
    The second coulumn will belong to the same class say "cPackage"and i will set each to the names of the second column datas. This apply to the rest of the columns.
    What am asking is simple. How can i build the tree dynamically so that the in each row, every data is parent to the next data. That is all what i want. What am doing is correct but i just need how to create the tree dynamically. Show me how to build trees dynamically from data.
    Thanks.

  • Trie data structure using Java

    No need to see the code...
    i properly documented for easy understanding....
    plz dont hesistate to go through code..
    class treenode{                //tree node structre....
       char ch;
       treenode child;
       treenode sibling;
        treenode(){                              //constructore
            child=null;
            sibling=null;
            ch='$';
    public class trie{
       treenode root=new node();             //defining root node
       public void main(String s{}){
             string s1[]={"hi","subbu","how r u"};
            for(int i=0;i<s1.lengh();i++){
                        storetrie(s1,root.sibling); //calling trie function
    printtrie(temp.sibling);
    printtrie(treenode temp){                             //printing trie
    if(temp!=null){
    System.out.print(temp.ch);
    printtrie(temp.child):
    printtrie(temp.sibling);
    public void storetrie(String str,treenode temp){       //constructing trie
    if(temp==null){             // if data is dissimilar
    int i=0,k=str.length(); //storing string length
    temp=new treenode();
    while(i<k){                 //add string to trie one charater by character
    temp.ch=str.charAt(0);
    str=str.substring(1); //forwarding string
    System.out.print(temp.ch);
    temp.sibling=null;
    temp.child=new treenode(); //for next child
    temp=temp.child; //moving to child
    i++;
    if(root.sibling==null){                  //errorrrrrrrrrrrrr        this condition should fail......but it is satisfying...........objects are passed through refences...it should change i think...
    System.out.println("root is null..");
    else{
    if(str.charAt(0)==temp.ch){
    storetrie(str.substring(1),temp.child);
    else{
    storetrie(str,temp.sibling);

    this is my actual code...
    this code will take some folder address on hard disk
    filenames stored in folders iam storing in trie
    trie is not printing...
    my code is not storing filenames in trie ...what could be the problem
    import java.io.*;
    import java.io.File;
    class treenode{
          char ch;
          treenode sibling;
          treenode child;
          public treenode(){
               sibling=null;
               child=null;
               ch='$';
    public class finalone{
           treenode root=new treenode();       //root node definition
           public static void main(String s[]){
                  finalone x=new finalone();
                  File f=new File("G:/Papers");      //folder address
                  x.store(f);
                  System.out.println();
                  x.printtrie1();                              //calling printing trie function
            public void printtrie1(){
               printtrie(root.sibling);
            public void store(File f){
                   if(f.isDirectory()){
                          File str[]=f.listFiles();
                          String strname[]=f.list();
                          for(int i=0;i<str.length;i++){
                                storetrie(strname,root.sibling);
    if(i==0)break;
    // System.out.println(strname[i]);
    // store(str[i]);
    else{
    // System.out.println(f);
    public void printtrie(treenode temp){
    if(temp!=null){
    System.out.print(temp.ch);
    printtrie(temp.child);
    System.out.println();
    printtrie(temp.sibling);
    public void storetrie(String str,treenode temp){
    if(temp==null){
    int i=0,k=str.length();
    temp=new treenode();
    while(i<k){
    if(str==null){
    return;
    temp.ch=str.charAt(0);
    str=str.substring(1);
    System.out.print(temp.ch);
    temp.sibling=null;
    temp.child=new treenode();
    temp=temp.child;
    i++;
    //temp=null;
    if(root.sibling==null){
    System.out.println("root is null..");
    else{
    if(str.charAt(0)==temp.ch){
    storetrie(str.substring(1),temp.child);
    else{
    storetrie(str,temp.sibling);

  • I have created a database, what is data structure and relationship?

    I have a database.
    I have 4 tables.
    Employee table
    Project Table
    Sales order table
    Customer table
    ================================
    SalesOrderId is unique
    EmploeeId Is unique
    CustomerID is unique
    ProjectId is unique
    What would be the relationship for these tables?
    Should I create 5th table that has salesOrderID and ProjectID and the primary key is the combination of salesOrderId and ProjectId?
    Is the whole process correct?
    Regards,
    GGGGGNNNNN
    GGGGGNNNNN

    . IDENTITY is never part of a valid data model and certainly not  a key.
    Identity can be a primary key, can't it be?
    It can be. What Celko is trying to say is that IDENTITY is not a good choice for a key. Unfortunately, he is sitting in an ivory tower and does not have very good ideas of real-world systems.
    More generally, when you design a database, you may decide to introduce a
    surrogate key in your tables. That is, a key which is not drawn from the data, but just generated in the system. Ideally, you should still have a real key in the data. The reason you would use the surrogate key is that the real key may be difficult to
    work with, for instance it is a long string or consists of many components.
    In practice, far from all entities can (easily) be described with a natural key, why the surrogate key is the only one you will have. However, you should always strive for finding a natural key, and not slap on IDENTITY as a matter of routine. For instance,
    say that you have a table called ProductCategories which defines which categories a product belongs to, that table should have a two-column of ProductID and CategoryID, and there should not be any IDENTITY column in that table.
    Generally, when I see people post a table table definition with an IDENTITY column and all other columns nullable, I know that they have not put in enough thought to their data-modelling.
    And, no, surrogate key != IDENTITY. IDENTITY is one way to implement surrogate keys, but you can also use guids, sequences (in SQL 2012 and up) or roll your own. Since IDENTITY incurs some limitations, you may want to avoid it. Sequences are cleaner and
    you don't have the same limitations. And rolling your own works very well, as long as you don't expect a high level of parallel inserts, which is what IDENTITY and sequences really are aimed for.
    We never put audit data in the table under audit. It is not just silly, it is illegal.
    What do you mean?
    Again, Celko is out of touch with reality. It may be illegal in Texas where he is sitting but not where you and I are sitting. It may also be illegal if the auditing is made for legal reasons. Obviously, if the auditing is mainly done to facilitate troubleshooting,
    your local law-enforcing authorities could not care less.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Mac died, hard disk data recoverable - does this include Desktop files?

    Hi there,
    My G5 died (well, it fell victim to my ex's violent outrage - logic board dead), anyway... I have had my hard disk made up so I can mount it / access it on my new mac. But will this include the files that were saved on my Desktop?
    Thanks in advance,
    Bree

    The desktop is just a graphical representation of a folder inside your User's home folder. Naturally, the folder is named "Desktop." For those that work in a cluttered environment and have a hard time finding files or folders on their desktop, you can see the contents of the desktop in alpha/numeric list view by going to the desktop folder (Users->[your user name]->Desktop).
    -DH

  • Need help in Data Structure in Java

    Design a FSA which accepts all strings over {a,b} which end in b, and in which every b (except for the last one) is immediately followed by two or more a's.
    Convert the following into a deterministic finite state automaton, using the subset construction algorithm.
    a,b
    \/ a b a
    --> 0 --> 1 --> 2 ---> 3
    State 3 is accepting.
    Describe (in English) the language which the regular expression (a|ba)* denotes.
    Using the techniques discussed in class, convert the regular expression in the previous problem to an FSA with epsilon transitions.
    Now convert the FSA from the previous problem to an equivalent FSA without epsilon transitions.
    I have to solve this problem .. can anyone help me out here?

    I have to solve this problem .. can anyone help me out
    here?Your code didn't show up in the post. Please re-post with code
    describing where you are having the problem.

  • Data Structures and Algorithms in java book

    Hi guys,
    I want to know a good book which is good for Data Structures and Algorithms in java. I am good at Core java but a beginner for Data Structures in Java. I am a little poor in Data Structures concepts.
    Following are the books I have found on the net. Could you help me the choose the best outta them.
    1. Data Structures and Algorithms in Java - Mitchell Waite
    2. Data Structures in Java - Sandra Anderson
    3. Fundamentals of OOP and Data Structures in Java - Richard Weiner & Lewis J. Pinson
    4. Object Oriented Data Structures Using Java - Nell Dale, Daniel T. Joyce, Chip Weems

    lieni wrote:
    I good data structures book doesn't have to be language-specific.Thx DrLazlo, my speachYes.
    The OP wrote:
    I have access to these books and dont know which one to start with.What I meant is that you shouldn't narrow your search to insist that the book you choose have "Java" in the title.

  • Need a good Data Structure/ Algorithm

    I am working on a small problem that requires me to cache a large amount of key/value pairs of data. I must then do a lookup on the cache for a large number of words one after another until I find a word that is present as a Key and then quit.
    The cache is pretty large. About 600 - 1000 words as keys and ints as values.
    Is there an existing Data Structure in Java for this? If not, what type of data structure (B-tree etc) is best suited to cache such data and what algorithm should be used for lookup?

    The lookup for hashmap is efficient for very large maps up to the amount of memory you have. If you tune the load factor you can minimise the impact of having very large tables.
    Another option is to have a fixed array of HashMaps. You can use the hashcode (or your own) to put the key, value into the HashMap. I am not sure if this is actaully any faster, as I believe one is enough, but if you have concern this is what you can do.

  • Tree Data Type for top-down travelling

    I need a tree data structure to represent a category-subcategory. Only algorithm I need is to find all children from a given node. What is the effective constructure of such tree?
    Thanks.

    The only reason they post is they know somebody will
    do their homework for them. The point being, don'tdo
    it for them. The ultimate point being -- you don't
    want to work with someone that got through theircomp
    sci degree by posting to forums (and copying from
    others), but it actually happens. I had a friend in
    college that got his degree this way, and to his
    graduating day -- he couldn't get 3 lines of code to
    coplile (yes, that means ever.)Come on, I don't believe for a minute that you can
    cheat your way to a masters degree by getting "help"
    from forums. And if you can it's the university that's
    to blame.I never said it was a Master in CS.. BS in CS.
    You say you won't do homework for people. Why not? if
    you find a question interesting why not do it and post
    if with a full explanation and full source code. A
    forum is a public environment. What you do here is
    there for everyone to see. By doing this you actually
    help universities stop potential cheating. It's
    somewhat counter-intiutive but this is how it works.Plagiarism is still cheating, and I believe it is taking credit for work you did not do: copying from a forum, public of not, is still cheating. In ancient times (when I was in college) they used to expell you for turning in other people's work (if you were caught).
    Also what do you know about this person you suspect is
    posting homework for the purpose of cheating. Nothing.
    It can be an isolated person who really has no one
    else to ask.In a University, college, or even HS environment there are always other people to ask--and that is how the system there works.
    Also why is helping someone with homework so
    especially awful. I would rather not help someone with
    work related problems. Why should I help someone for
    free to do something they've been hired to do and get
    paid to do?What is the differenct? When you get the degree you are certified by a major institution of learning to know the materials covered in the coursework you completed. Employers used to assume becasue you have a degree you actually knew a little about the subject. Not any more!!! I wish you could see the millions of dollars each year that are wasted screening unqualified people that have degrees and the millions of dollars wasted trying to work with the ones that made it through the interviews because you did assume they knew at least the basics of the course work for the degree. (I speak here from experience.) We have had to make much more rigorous testing for our candidates to screen out the unqualified--basically you have to take an aggregate final to get into the interview process.
    Also I find cheaters who makes it to a job quite
    benign. There are other types I dislike more, like the
    psychopats and the bullies to name a few.If I have 10 workers and 8 of them cheated their way through college and do not have the problem solving, imagination, and skills needed to be productive and I have 2 "bullies" that give me the world on a silver platter when ever I ask them to do something... guess who is going to get the raises and promotions.
    My conclusion is that you should post at forums only
    if it gives YOU something.I support free information, and I share knowlege and ideas freely and try to cultivate an environment that other will do so too. I have to put a limit there when students want HW done--it is their assignment to do it, they are graded not only on correctness, but also on imagination, problem solving. Do it for them and you weaken the system and eventually the industry.
    As I have said in forums before: Cheating at college level and getting your degree when you are unqualified now costs millions in dollars that have to passed on to the general public to maintain normal operation. Does cheating hurt? Believe it or not, it cost you dollars out of your pocket each and every day.

  • Data Structures in SQL Server

    Friends,
    I am giving a session on "Data structures and SQL Server" for one of the SQL Server communities in India.
    My idea is to explain high level concepts of data structures (Stacks, Queues, Linked lists, Trees, Graphs etc.)
    here are my questions.
    Like to know how data structure concepts are implemented SQL Server components (in a high level).
    Here are some hints in my mind:
    1. Queues - SQL Server - DMVs for Processor Queue length, Disk Queue length etc.
    2. Linked Lists - SQL Server - Previous and Next page pointers in Page headers (and DBCC IND)
    3. Trees - SQL Server - Btrees in Indexes (DBCC IND and DBCC PAGE of Index pages)
    3. Linear Search - SQL Server - Table Scan
    4. Binary Search - SQL Server - Index Seek
    What i need is:
    1. Sorting algorithm used in SQL Server?
    2. Stack concept used in SQL Server? I think No
    3. what else data structure concepts are implemented in SQL Server (that can be demonstrated)
    Note: level: 300 - Intermediate to Advanced.
    Thanks in advance
    Ramkumar
    [email protected]
    Ramkumar Gopal Living For SQL Server Blog: http://www.sqlservercentral.com/blogs/livingforsqlserver/ Facebook: https://www.facebook.com/#!/groups/livingforsqlserver/ Twitter: https://twitter.com/LivingForSQL

    Hello,
    Take a look at some structures created for In-Memory OLTP (hash indexes, etc.)
    http://download.microsoft.com/download/5/F/8/5F8D223F-E08B-41CC-8CE5-95B79908A872/SQL_Server_2014_In-Memory_OLTP_TDM_White_Paper.pdf
    BUF Structures.
    http://blogs.msdn.com/b/karthick_pk/archive/2013/03/16/sql-server-memory.aspx
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Request: DATA STRUCTURES files and examples

    please could you provide me some resources Data Structure using Java (NetBeans)..
    I hardly understood our instructor lessons..

    mark2k7 wrote:
    nonsense replies from nonsense people!! WTF!! Indeed. That's what everyone thought reading your question. Perhaps if you put a little more thought into asking specific, coherent questions you would get more useful answers.

  • Data structure for simulation of message queue

    Hello,
    I have undertaken a project of simulating the point to point and publish/subscribe protocols of message queueing. This whole project would be done just in Java. There won't be any system level programming. Which data structure in Java would be the most efficient one for the message queue?

    Hello,
    I have undertaken a project of simulating the point to point and publish/subscribe protocols of message queueing. This whole project would be done just in Java. There won't be any system level programming. Which data structure in Java would be the most efficient one for the message queue?

Maybe you are looking for

  • Is there a way to transfer pictures from android phone (Virgin Mobile Kyocera Rise) to new iPhone 5?

    Is there a way to transfer pictures from android phone (Virgin Mobile Kyocera Rise) to new iPhone 5?

  • Does duplicating layers from an 8-bit PSD reduce the color depth of a new 16-bit edit?

    I have been using several versions of Photoshop over the years starting with CS3, then CS6, and finally CC. Through 2012, all my RAW files were converted using 16-bit color depth in ACR. However, in examining my files recently, I noticed all were in

  • Validator.xml not working

    hi I am using the struts framework1.1.I have developed a login page with username and password.i want to write a validator.xml for it in accordance with validator-rules.xml as defined by struts1.1.and i have a welcome page that i want to direct this

  • Erreur à chaque mise à jour OS

    Bonjour, Je possède un macbook pro fin 2008 et je fais face à un problème récurrent ! J'ai voulu installer Mountain Lion et Mavericks (hier soir) que j'ai acheté sur AppStore et j'ai rencontré quelques problèmes : - La mise à jour se télécharge corre

  • Frequently freezing.

    The last few weeks my MacBook Pro has been freezing at the loading page, the loading wheel will just freeze before loading the log in page. I ran my mac off the disk and did a disk utility repair which finally got me through to the desktop. I then up