Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
 public MyTrie()
 {
     _root = new MyTrieNode();
 }