Implementing an Iterator for Binary Trees
Ξ August 5th, 2009 | → 0 Comments | ∇ .Net Framework, Algorithms, Tools and technologies |
Some time ago I wrote a post showing how to implement a generic binary search tree data structure in C#. In today’s post I will provide a way of extending the binary data structure in order to be able to use LINQ in order to query it. In order to be able to use LINQ over a custom data structure, all that we have to extend our data structure such that it implements the IEnumerable<T> interface. This is due to the fact that LINQ provides a set of extension methods that extend the functionality of types inheriting from IEnumerable<T>.