C# Class RadixTree.Tree

显示文件 Open project: paratechnical/RadixTree Class Usage Examples

Public Methods

Method Description
Delete ( string label ) : void

Delete: Delete a string from the tree. First, we delete the corresponding leaf. Then, if its parent only has one child remaining, we delete the parent and merge the two incident edges.

DeleteRec ( string wordPart, Node curNode ) : void

delete a word from the tree means delete the last leaf that makes up the stored word

FindPredecessor ( string word ) : string

Find predecessor: Locates the largest string less than a given string, by lexicographic order.

FindSuccessor ( string word ) : string
Insert ( string word ) : void

insert a word into the tree

Lookup ( string word ) : bool
Tree ( ) : System

construct a new tree with it's root

Private Methods

Method Description
FindPredecessorRec ( string wordPart, Node curNode, string carry ) : string

FindSuccessorRec ( string wordPart, Node curNode, string carry ) : string
InsertRec ( string wordPart, Node curNode ) : void

recursively traverse the tree carry the word you want inserted until a proper place for it is found and it can be inserted there if a node already stores a substring of the word(substrnig with the same first letter as the word itself) then that substring must be removed from the word and it's children checked out next hence the name wordPart - part of a word

LookupRec ( string wordPart, Node curNode ) : bool

look for a word in the tree begining at the current node

MatchingConsecutiveCharacters ( string word, Node curNode ) : int

given a string and a node the number of characters that the string and the node's label have in common starting from the first character in each is returned

Method Details

Delete() public method

Delete: Delete a string from the tree. First, we delete the corresponding leaf. Then, if its parent only has one child remaining, we delete the parent and merge the two incident edges.
public Delete ( string label ) : void
label string
return void

DeleteRec() public method

delete a word from the tree means delete the last leaf that makes up the stored word
public DeleteRec ( string wordPart, Node curNode ) : void
wordPart string
curNode Node
return void

FindPredecessor() public method

Find predecessor: Locates the largest string less than a given string, by lexicographic order.
public FindPredecessor ( string word ) : string
word string
return string

FindSuccessor() public method

public FindSuccessor ( string word ) : string
word string
return string

Insert() public method

insert a word into the tree
public Insert ( string word ) : void
word string
return void

Lookup() public method

public Lookup ( string word ) : bool
word string
return bool

Tree() public method

construct a new tree with it's root
public Tree ( ) : System
return System