本文整理汇总了C#中RedBlackTree.BredthContains方法的典型用法代码示例。如果您正苦于以下问题:C# RedBlackTree.BredthContains方法的具体用法?C# RedBlackTree.BredthContains怎么用?C# RedBlackTree.BredthContains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBlackTree
的用法示例。
在下文中一共展示了RedBlackTree.BredthContains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmptyTreeTest
public void EmptyTreeTest()
{
var tree = new RedBlackTree<Int32>();
Assert.IsTrue(tree.IsEmpty);
Assert.IsFalse(tree.BredthContains(2));
}
示例2: RootNodeTest
public void RootNodeTest()
{
var tree = new RedBlackTree<Int32>();
tree.Insert(10);
Assert.IsFalse(tree.IsEmpty);
Assert.IsTrue(tree.BredthContains(10));
Assert.AreEqual(10, tree.RootNode.NodeValue);
}
示例3: ContainsSuccessTest
public void ContainsSuccessTest()
{
var tree = new RedBlackTree<Int32>();
tree.Insert(10);
tree.Insert(25);
tree.Insert(7);
Assert.IsTrue(tree.BredthContains(25));
}
示例4: ContainsFailureTest
public void ContainsFailureTest()
{
var tree = new RedBlackTree<Int32>();
tree.Insert(10);
tree.Insert(25);
tree.Insert(7);
Assert.IsFalse(tree.BredthContains(2));
}
示例5: SpeedTest
public void SpeedTest()
{
var tree = new RedBlackTree<Int32>();
var stopWatch = Stopwatch.StartNew();
InsertMultipleNodes(tree, 100000);
stopWatch.Stop();
Debug.WriteLine(String.Format("Insert Time: {0} milliseconds ", stopWatch.ElapsedMilliseconds));
var searchStopWatch = Stopwatch.StartNew();
var found = false;
found = tree.BredthContains(777);
searchStopWatch.Stop();
Debug.WriteLine(String.Format("Search Time: {0} ticks ", searchStopWatch.ElapsedTicks));
Assert.IsTrue(found);
}