public IBinarySearchTree <TKey, TValue> Search(TKey key) { int compare = comparer.Compare(key, theKey); if (compare == 0) { return(this); } if (compare > 0) { return(Right.Search(key)); } return(Left.Search(key)); }
public IBinarySearchTree <K, V> Search(K key) { int compare = key.CompareTo(Key); if (compare == 0) { return(this); } else if (compare > 0) { return(Right.Search(key)); } else { return(Left.Search(key)); } }
public void BSTWithLinkedList_Search_EmptyTree_ReturnsFalse() { // Arrange, Act, Assert Assert.IsFalse(_bst.Search(1)); }