C# 클래스 rmandvikar.Trie.Trie

Trie data structure.
상속: ITrie
파일 보기 프로젝트 열기: vladislav-karamfilov/TelerikAcademy

Private Properties

프로퍼티 타입 설명
AddWord void
GetTrieNode TrieNode
GetWords void
Trie System.Collections.Generic

공개 메소드들

메소드 설명
AddWord ( string word ) : void

Add a word to the Trie.

GetWords ( ) : ICollection

Get all words in the Trie.

GetWords ( string prefix ) : ICollection

Get words for given prefix.

HasWord ( string word ) : bool

Returns true or false if the word is present in the Trie.

WordCount ( string word ) : int

Returns the count for the word in the Trie.

비공개 메소드들

메소드 설명
AddWord ( TrieNode trieNode, char word ) : void

Recursive method to add word. Gets the first char of the word, creates the child TrieNode if null, and recurses with the first char removed from the word. If the word length is 0, return.

GetTrieNode ( string prefix ) : TrieNode

Get the equivalent TrieNode in the Trie for given prefix. If prefix not present, then return null.

GetWords ( TrieNode trieNode, ICollection words, StringBuilder buffer ) : void

Recursive method to get all the words starting from given TrieNode.

Trie ( TrieNode rootTrieNode ) : System.Collections.Generic

Create a new Trie instance.

메소드 상세

AddWord() 공개 메소드

Add a word to the Trie.
public AddWord ( string word ) : void
word string
리턴 void

GetWords() 공개 메소드

Get all words in the Trie.
public GetWords ( ) : ICollection
리턴 ICollection

GetWords() 공개 메소드

Get words for given prefix.
public GetWords ( string prefix ) : ICollection
prefix string
리턴 ICollection

HasWord() 공개 메소드

Returns true or false if the word is present in the Trie.
public HasWord ( string word ) : bool
word string
리턴 bool

WordCount() 공개 메소드

Returns the count for the word in the Trie.
public WordCount ( string word ) : int
word string
리턴 int