Skip to content

manosriram/Radix-Tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Implementation of Radix-Tree

Radix Tree

Usage

Insert(word, node);  // Insert a word into node. (RadixNode *)

isLeafNode(node);  // Check if Node is Lead or Not. (Boolean)

Traverse(node);  // Traverse the Tree starting from node. (Void)

Find(node, word); // Search for a word in the Tree. (Boolean)

Example

#include "Radix.hpp"
using namespace RAX;

int main() {

    RadixNode *root = new RadixNode();

    Insert("romane", root);
    Insert("romanus", root);
    Insert("romulus", root);
    Insert("rubens", root);
    Insert("ruber", root);
    Insert("rubicon", root);
    Insert("rubicundus", root);
    
    Traverse(root);
    cout << Find(root, "ruber") << endl;
}

Output

romane
romanus
romulus
rubens
ruber
rubicon
rubicundus

1