/// <summary> /// Get all the suggestions from /// </summary> /// <param name="temp">node</param> /// <param name="prefix">prefix the user inputed</param> /// <returns></returns> public List <string> GetSuggestions(MyTrieNode temp, string prefix) { List <string> result = new List <string>(); GetSuggestionsWithLimits(temp, result, "", prefix, prefix.Length, 0); return(result); }
/// <summary> /// Burst the container, replace it with a node and the most common character will be the child of that node /// anything left will be put in containers approriately /// </summary> /// <param name="temp">container</param> /// <returns>a node with an array of children that are either a node or container</returns> public MyTrieNode BurstThisContainer(BurstNavigable temp) { MyTrieNode node = new MyTrieNode(); IEnumerator <Word> _enumerator = temp.GetChildren().GetEnumerator(); while (_enumerator.MoveNext()) { node.Add(_enumerator.Current.content.ToCharArray(), 0, _enumerator.Current.pageCount); } return(node); }
public MyTrie() { _root = new MyTrieNode(); }