public void TestCountWorksCorreclyAfterDeleteMaxWithOnlyRootLeft() { this._bst = new BinarySearchTree <int>(); this._bst.Insert(12); this._bst.DeleteMax(); Assert.AreEqual(0, this._bst.Count); }
public void TestEachInOrderWorksCorrectlyWithEmptyCollection() { this._bst = new BinarySearchTree <int>(); StringBuilder result = new StringBuilder(); this._bst.EachInOrder((el) => result.Append($"{el}, ")); StringAssert.AreEqualIgnoringCase("", result.ToString()); }
public void InitializeBST() { this._bst = new BinarySearchTree <int>(); this._bst.Insert(12); this._bst.Insert(21); this._bst.Insert(5); this._bst.Insert(1); this._bst.Insert(8); this._bst.Insert(18); this._bst.Insert(23); }
public void InitializeBST() { this._bst = new BinarySearchTree <int>(); this._bst.Insert(12); this._bst.Insert(21); this._bst.Insert(5); this._bst.Insert(1); this._bst.Insert(8); this._bst.Insert(18); this._bst.Insert(23); /* 12 * / \ * 5 21 * / \ / \ * 1 8 18 23 */ }