Data Structures Galore

Today we learned about four different data structures: the array, stack, queue, and binary tree. 



Arrays are basically a list of inputs. Arrays are numbered starting from zero (0), so the first space/box in an array is actually the zeroth spot in the array. When using an array, you can get any information from the array by just specifying which spot in space/box in the array that piece of information is.



Stacks are like this ice cream. The first scoop of ice cream you put into a stack will always be the last scoop of ice cream you will be able to eat, because you will have to eat all the other ice cream before you can get to the very first scoop that you put on the cone. Like-wise, the first piece of information you put into a stack will be the last piece of information you can extract from a stack, hence the acronym FILO (First In Last Out).



Queues are quite easy to understand, as the word “queue” is a synonym for “line”. In the diagram above, there is a line to get ice cream. The first person in line is able to get the ice cream and be the first person out of line. Queues work in the same way, as the first piece of information you put in is the first piece of info you will be able to take out.

Binary Trees


Binary trees, when drawn like the diagram above, resemble… you guessed it! Trees! Binary trees are quite simple. You start with the root (the base/trunk of the tree). The trunk splits into two branches (called children). Each branch then splits into another two branches. This continues until the binary tree is complete. The branches that do not have children are called leaves (shown in green on the diagram).

And there you have it! Four data structures in… maybe more than 4 minutes of reading. 🙂

3 thoughts on “Data Structures Galore

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s