Discussing the article: "From Basic to Intermediate: Queues, Lists, and Trees (V)"

 

Check out the new article: From Basic to Intermediate: Queues, Lists, and Trees (V).

In this article, we implemented the first components of a tree structure. Since I realize that this structure can be very complex at the beginning of the learning process, we will introduce it gradually, step by step. This way, everyone will be able to understand how a tree works and when it is best to use one.

So, if a list solves the problem of queues and can even replace them in many situations, why do we need trees? And what role do they play in all of this? Well, dear reader, trees are the natural evolution of lists, and they have an even nobler purpose. "Okay, but I still don't understand. Could you explain this in more detail before we start looking at the code?" Of course I can. I think that understanding the purpose of trees before looking at the code will help you understand the code itself. To understand trees, you need to understand the problem of lists. Yes, and although they solve the problem of queues, lists themselves have their own problems. For this reason, another data structure was created that allows elements to be searched for more efficiently. Do you understand? How is that possible?

To understand this, imagine lists with thousands—perhaps even billions—of elements, a number that might seem unimaginable to most people. However, even lists containing several thousand elements can create problems when searching. The main problem is the time a search takes.



Author: CODE X