Home > C#, Data Structures > Binary trees in C#

Binary trees in C#

Great C# implementation of a binary tree by Roni Schuetz.

As simple to use as this:

    var x = new BinaryTree<int>();

Or this:

    var y = new BinaryTree<Taxicab>();
    y.Add(new Taxicab() { number = 3 });
    y.Add(new Taxicab() { number = 1729 });

    class Taxicab:IComparable<Taxicab>
        public int number { get; set; }
        public int frequency { get; set; }
        public int CompareTo(Taxicab other)
            if (this.number < other.number)
                return -1;
            else if (this.number == other.number)
                return 0;
                return 1;


  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: