Question

What are the benefits or advantages to using a tree structure in a managed language or framework over flat structures provided by said language or framework, aka .NET, and are there any libraries for such a structure?

Was it helpful?

Solution

The advantages are the same as those for a tree structure in any language. Take a look at the Wikipedia article on balanced binary search trees. Balanced trees get you logarithmic insert and access time, and they keep elements sorted.

The most commonly used application of tree structures is for sorted maps and sets. In .NET, take a look at SortedDictionary, which uses a balanced search tree.

I'm assuming this is what you're talking about because it's the most common kind of tree in application programmer land, but trees are used for all sorts of things in computer science. Take a look at the more general article on tree data structures if you want more on this.

OTHER TIPS

How long is a piece of string?

The comparative benefits of trees over other data structures depend on the type of data you are storing, and the types of operations you are planning on doing over the data.

(Being in a managed framework has nothing to do with it, by the way.)

You're going to have to fill in a lot more details if you want to get a more intelligent response.

Alternately, you can take a beginning Algorithms and Data Structures course, and learn the lay of the land.

A tree is an ideal data structure for managing information that is organized hierarchically. This is true for whatever language you happen to be using.

Here is just a small sampling of the many applications of the tree data structure:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top