Results 1 to 4 of 4

Thread: 2-4 tree

  1. #1
    number22 is offline Member
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    Default 2-4 tree

    Hi, I havo to implement a 2-4 tree, but I have some problems;
    I have create the Entry class, my 2-4 tree will contain Entry objecs..but I don't know I can realize the node of the tree! In my book is said to realize the node using an array. How can I do it?
    Thank you

    P.S.: I'm sorry for my english but I'm not english

  2. #2
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default

    I have no clue what a 2-4 tree is, + node (hum...) reminds me of a 3d engine for python...
    Are you scripting with java using a "not included" package like 3d engine?

  3. #3
    number22 is offline Member
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    Default

    Yes..I don't use any package..

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,763
    Blog Entries
    7
    Rep Power
    21

    Default

    A 2-4 tree is a B-tree ('B' doesn't stand for 'binary'); every node has between 2 and 4 data items except for the root node, it has between 0 and 4 data items. For two data items i1 and i2 (i1 < i2) lies a pointer to a child node that contains all the data items between i1 and i2 (exclusive). The tree is balanced; if after an insertion a node contains more than 4 items the node is split and the check is done again for the parent node, all the way to the root; if the root needs to be split a new root node is created. Similar with deletes: if a node contains less than 2 items the node is joined with a neighbour node (if possible, otherwise an item is borrowed from the parent and the check needs to be made again, all the way to the root). My guess is that Google is your friend here because there are quite some details to get right.

    kind regards,

    Jos

Similar Threads

  1. Binary Tree
    By MuslimCoder in forum New To Java
    Replies: 8
    Last Post: 11-19-2009, 06:57 PM
  2. Help Tree Set
    By ShuiYinDeng in forum New To Java
    Replies: 2
    Last Post: 10-29-2009, 11:45 AM
  3. Creating a Tree and then saving the Tree
    By jackmatt2 in forum New To Java
    Replies: 0
    Last Post: 08-22-2009, 01:51 PM
  4. B tree
    By wide in forum New To Java
    Replies: 2
    Last Post: 07-01-2009, 12:37 AM
  5. Need Help With Tree Adt
    By avi in forum New To Java
    Replies: 0
    Last Post: 03-20-2008, 04:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •