Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 925 Bytes

README.md

File metadata and controls

53 lines (37 loc) · 925 Bytes

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