There is an interesting data structure that has got its application in a wide number of scenarios in computer science. This data structure is Tree. Other data structures such as arrays, linked list, stack, and queue are linear data structures that store data sequentially.
To perform any operation in a linear data structure, the time complexity increases along with the increase in the data size (input data). But, it is not acceptable in today’s computational world since we have a lot of data to be processed.
Different tree data structures allow quicker and easier access to the data as it is a non-linear data structure.
But before getting into that, let’s ask ourselves a question.
Q: How should we decide which data structure to use?
Our choice of data structure depends upon several factors:
Q: What do we use Tree for?
Tree is one data structure that’s quite often used to represent hierarchical data. For example, let’s say we want to show employees in an organization and their positions in an organizational hierarchy, we can show it like this:
This particular logical structure in the image above is a Tree. If we look at this structure upside down and then it will resemble a real tree. The root here is at the top and we are branching out in a downward direction. The logical representation of the tree data structure is always like that. Root at the top and branching out in a downward direction.
#mobile apps development #website development #data-science