Is there a binary tree in . NET?

Asked

Viewed 890 times

4

I don’t know if it’s hidden somewhere and I haven’t seen a binary tree structure on . NET.

I searched the documentation of all Collection, including the sublevels and nothing. Don’t have it? Why wouldn’t it have something so important?

1 answer

6


Binary tree usually has problems with reference location, so avoid use. O . NET Framework and Core try to provide the most useful structures only and let each one provide the others, especially if one considers that there are several ways to implement a binary tree, the . NET could not deliver all needed.

There’s actually a binary tree in the . NET, but this is considered detail of implementing structures that guarantee a certain commitment, nothing guarantees that it will be a binary tree. It is better to give solutions than specific structures. See SortedDictionary. There is also the SortedList.

There are some ready-made implementations, perhaps the best known ones are PowerCollections (I hope they migrate to Github, there are those who put) and the C5. Perhaps you will find one that is useful for your need there. Otherwise you have to search for others or make your own implementation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.