Thread: 2-3 tree

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    5

    Question 2-3 tree

    Can someone tell me where I can find code for 2-3 tree, such as insert, delete or find in a 2-3 tree, or if anyone had done it before please help me with it. Or even books that have code of 2-3 tree, I would really appreciate any help, thank you!

  2. #2
    William
    Guest
    What's a 2-3 tree??? If it's a tree, then I have done quite a few.

    Basically you'll need Node class with functions like :
    struct Node
    {
    Node* getKids();
    int getNbKids();
    void addKid();
    };

    Then you'll need a Tree class with an iterator, like :
    struct Tree
    {
    void setIteratoRoot(Node* root);
    Node* getNextNode();
    };

    The iterator idea will let you step through the tree (for example to find a Node). The node class will allow you to insert kids, or delete a branch.

    You create generic Node and Tree classes which you will then subclass to add attribute and functions specific to your application.

    Hope this helps.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    5
    Yes it is one of the tree type, a 2-3 tree is a tree with a maximum of 2 or 3 children. but I'm stuck in this insertion thing. That's why I need someone who has done it before and show me the code.

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    5
    So really no one can help me with this? Come on! I really would appreciate any help!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  2. Binary Tree, couple questions
    By scoobasean in forum C Programming
    Replies: 3
    Last Post: 03-12-2005, 09:09 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM