本文整理汇总了C#中BinaryTree.IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryTree.IsEmpty方法的具体用法?C# BinaryTree.IsEmpty怎么用?C# BinaryTree.IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryTree
的用法示例。
在下文中一共展示了BinaryTree.IsEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTest
public void AddTest()
{
var tree = new BinaryTree<int>();
Assert.IsTrue(tree.IsEmpty());
tree.Add(3);
Assert.IsFalse(tree.IsEmpty());
tree.Add(1);
tree.Add(4);
Assert.IsTrue(tree.Contains(3));
Assert.IsTrue(tree.Contains(1));
Assert.IsTrue(tree.Contains(4));
Assert.IsFalse(tree.Contains(2));
Assert.IsFalse(tree.IsEmpty());
}
示例2: DeleteTest
public void DeleteTest()
{
var tree = new BinaryTree<float>();
tree.Add(4.21f);
tree.Add(421);
tree.Add(42);
tree.Add(1);
tree.Add(1000.500f);
tree.Delete(4.21f);
Assert.IsFalse(tree.Contains(4.21f));
Assert.IsTrue(tree.Contains(421));
Assert.IsTrue(tree.Contains(42));
Assert.IsTrue(tree.Contains(1));
tree.Delete(421);
Assert.IsFalse(tree.Contains(421));
Assert.IsTrue(tree.Contains(1));
tree.Delete(1);
Assert.IsFalse(tree.Contains(1));
Assert.IsFalse(tree.Contains(421));
Assert.IsTrue(tree.Contains(42));
tree.Delete(42);
Assert.IsFalse(tree.Contains(42));
Assert.IsTrue(tree.Contains(1000.500f));
tree.Delete(1000.500f);
Assert.IsFalse(tree.Contains(1000.500f));
Assert.IsTrue(tree.IsEmpty());
}