public void SuccessorAndPredecessorTest() { tree.AddRange(new Node <int>[] { item }); var suc = tree.Successor(); var pred = tree.Predecessor(); Assert.AreEqual(tree.GetMin(tree.root.Right), suc); Assert.AreEqual(tree.GetMax(tree.root.Left), pred); }
public void SetUp() { item = new Node <int>(7); item1 = new Node <int>(4); item2 = new Node <int>(5); item3 = new Node <int>(71); item4 = new Node <int>(50); tree = new AVLTree <int>(); tree.root = new Node <int>(15, new Node <int>(6), new Node <int>(23)); tree.Insert(item); tree.Insert(item2); tree.Insert(item3); tree.Insert(item4); tree.Insert(item1); tree.Insert(new Node <int>(1)); tree.Insert(new Node <int>(77)); tree.AddRange(new Node <int>[] { new Node <int>(76), new Node <int>(75), new Node <int>(74), new Node <int>(98), new Node <int>(99), new Node <int>(43), new Node <int>(44), new Node <int>(51), new Node <int>(59), new Node <int>(60) }); tree.Insert(null); }
public void AddTest() { List <Node <Student> > listStudent = new List <Node <Student> >(); foreach (var item in listStu) { listStudent.Add(new Node <Student>(item)); } tree.AddRange(listStudent.ToArray()); Student student = null; tree.Insert(student); tree.Insert(new Node <Student>(listStu[10])); Assert.IsTrue(tree.ToList().Count <= listStu.Count); Assert.NotNull(tree.root); }