RadixTree.Tree.FindPredecessor C# (CSharp) Method

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
        public string FindPredecessor(string word)
        {
            return FindPredecessorRec(word, _root,string.Empty);
        }

Usage Example

示例#1
0
        static void Main(string[] args)
        {
            var tree = new Tree();
            tree.Insert("romane");
            tree.Insert("romanus");
            tree.Insert("romulus");
            tree.Insert("rubens");
            tree.Insert("ruber");
            tree.Insert("rubicon");
            tree.Insert("rubicundus");

            Console.WriteLine("predecessor of the word \"romanes\":" + tree.FindPredecessor("romanes"));
            Console.WriteLine("successor of the word \"rom\":" + tree.FindSuccessor("rom"));

            Console.WriteLine(tree.Lookup("romulus") ? "there" : "not there");

            tree.Delete("romanus");
        }
All Usage Examples Of RadixTree.Tree::FindPredecessor