本文整理匯總了C#中BinarySearchTree.Sucessor方法的典型用法代碼示例。如果您正苦於以下問題:C# BinarySearchTree.Sucessor方法的具體用法?C# BinarySearchTree.Sucessor怎麽用?C# BinarySearchTree.Sucessor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BinarySearchTree
的用法示例。
在下文中一共展示了BinarySearchTree.Sucessor方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestSuccessor
public void TestSuccessor()
{
var tree = new BinarySearchTree<int>();
var firstNode = new TNode<int> (7);
tree.Insert(firstNode);
Assert.IsNull(tree.Sucessor(firstNode), "#C01");
var secondNode = new TNode<int>( 4 );
tree.Insert(secondNode);
Assert.AreEqual(firstNode, tree.Sucessor(secondNode), "#C02");
var thirdNode = new TNode<int> (5) ;
tree.Insert(thirdNode);
Assert.AreEqual(thirdNode, tree.Sucessor(secondNode), "#C03");
Assert.IsNull(tree.Sucessor(firstNode), "#C04");
var fourthNode = new TNode<int>(9);
tree.Insert(fourthNode);
Assert.IsNull(tree.Sucessor(fourthNode), "#C05");
}