Is there a built in AVL Tree in the .NET libraries?
I searched but didn't find any.
You can use a System.Collections.Generic.SortedSet<T>
. I think it is implemented using a red-black tree which is very similar to an AVL tree.
A quick search found an implementation here. The code looks clean, but I haven't tried it.
If nothing else, you could do a quick performance test against SortedSet<T>
(as suggested by @Josef) to see if there's any difference for your use case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With