A tree is one of the most common computer science data structures and a natural way to model certain domains. All people encounter trees (as a data structure) in one way or another, even those who aren't programming or interacting with computers in general. The most obvious example is the family tree, and a file tree when considering computers. HTML (like JSON, XML, and many others) also has a tree structure. Comments and product catalogs on websites are also trees. Any hierarchy is a tree by definition.
There is one very intriguing aspect associated with trees. A developer's ability to understand trees and work with them is directly proportional to their overall level. If it is easy for a developer to work with trees, then most likely have a pretty good understanding of coding, including when reading someone else's code. If, on the other hand, they don't know enough about trees, then they'll likely have more difficulty writing and analyzing code.
There are no new syntax or programming elements in this course that you haven't seen before in Hexlet courses. However, trees are more complicated topic above all because of the recursive nature of the trees themselves. You have to make your brain work properly, and this is probably the hardest part, you can't just read the theory and develop the understanding linearly. The only way is to practice and go through a trial-and-error process.
To better understand and memorize the learning material, our recommendations are the same as before:
- Be sure to practice all the code given in the theory yourself, on your local environment
- Use the debug print as much as you can. Log all data changes while the code is running
- Repeat the lessons from the JS: Functions course on recursion
In this short course, we'll get to grips with how trees work and how to use them. You won't see algorithms in this course as they're taught at university. This course has very different goals. We'll teach you how to work with recursive data structures through tree recursion.
Are there any more questions? Ask them in the Discussion section.
The Hexlet support team or other students will answer you.
For full access to the course you need a professional subscription.
A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.