Word Locator
 All Classes Files Functions Variables Typedefs
Public Member Functions | List of all members
RBTree Class Reference

implementation of Red-Black Tree More...

#include <wl.h>

Public Member Functions

 RBTree ()
 Constructor of RBTree. More...
 
 ~RBTree ()
 Destructor of RBTree. More...
 
void insert (wpp_t newword)
 Insert a word-pos pair into the tree. More...
 
void clear ()
 Clear the tree. More...
 
TreeNodegetNode (string word)
 Get the node that stores the word. More...
 
void printTree ()
 

Detailed Description

implementation of Red-Black Tree

ref: https://en.wikipedia.org/wiki/Red%E2%80%93black_tree

Constructor & Destructor Documentation

RBTree::RBTree ( )

Constructor of RBTree.

Not much to be done. Initialize the root pointer to NULL

RBTree::~RBTree ( )

Destructor of RBTree.

Rree all nodes

Member Function Documentation

void RBTree::clear ( )

Clear the tree.

Clear the tree by free and delete all nodes. Root is set to NULL

TreeNode * RBTree::getNode ( string  word)

Get the node that stores the word.

Locate and return the node that saves the occurance of the word

Parameters
word- A string word that is needed to locate and return
void RBTree::insert ( wpp_t  newword)

Insert a word-pos pair into the tree.

Insert new word, either add to existing or create new node

Parameters
newword- wpp_t stucture with {word, pos}
void RBTree::printTree ( )

Public method to in-order print tree


The documentation for this class was generated from the following file: