This week we finally learned about trees. So why do we need to learn trees and other recursively defined data structures? Well, there are actually quite a few reasons why people went through all this trouble to come up with the idea. Here I've compiled a short list of the benefits of using trees and other recursive data structures:
- Simpler and more readable code.
- No need to preserve state on each iteration.
- More often than not more memory-efficient.
- Easier to search for items, since tree traversals can be easily coded.
No comments:
Post a Comment