Tree Data Structure

A glance at Tree Data Structures…

Blog Presentation version…**

Ready..set..Let’s go!

But first, what are Data Structures?

Data Structures are simply a way of organizing data in a computer so that it can be used efficiently.

Reasons to implement Tree Data Structure can be to construct sorted list of data, prefix matching in text fields, just increasing efficiency in searching through data.

So I followed along with this tutorial and made a general-purpose tree. In this example you only need to understand these three major parts of a Tree Data Structure: The Root 

It is the entry point of the data structure. But to be technical: It is levelO of the tree.

A node:

Block of data. It can contain anything depending on what we are making. Nodes can have “children” and branch off with data.

A leaf:

Leaves are coming…

Is a node meaning it contains a block of data. However it cannot branch off and have “children”.

Parent is an optional because not all nodes have Parents’ this is the exception for the root node since it is the entry point.

I create three nodes to be beverages and then split off into cold and hot. When adding other elements to the tree they will each be represented with their respective parent connections.

On this page even though it just looks like a repetitive string, I am adding nodes and leaves. At the bottom there was a suggested extension created for a function on Node so that I can search through and try to print something for my hard work.

Which was extremely hard…

So I was able to get milk and once I kept on messing around with the guide.**

Doing the thing!

I was having trouble trying to access the different teas for example. But I did the thing and it was cool to tinker around and just learn as I went. I don’t know how necessarily in this example how it is more efficient, but I did the thing.

Joel to the rescue

Thanks to Joel we found a way to print all the contents I wanted using forEach function available to arrays.

Sources(to take the NS click links below to learn further about execution):

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.