I’d like to improve the C# track implementation of the Binary Search Tree exercise.
The idea is similar to what we have previously implemented in Simple Linked List exercise as discussed on the forum and described in previous PR.
The current tests and reference implementation require for the data structure to be implemented in a very “exposed” way. It is very “academic” implementation and very much different to how .net does things with encapsulation and generic types. Changes would make for better implementations, and more educational value in my opinion.
Since the BST structure is a search one, I would remove the current IEnumerable
elements and instead add a constraint on T
to be IComparable
. I would expect the BinarySearchTree<T>
type to implement two properties Count
and Depth
and two methods Add
and Contains
.
What do you think, @ErikSchierboom