Since Tyler couldn't make it today, I will be explaining our new topic, Data Structures. There are 4 types of Data Structures:
Stacks
Queues Binary Search Trees
Priority Queues
Let's take this example:
In Stacks and Queues, You'll see the methods PUSH and POP. PUSH inserts an item into the stack/queue. POP has different effects based on whether it's a Stack or a Queue.
When using POP, Stacks uses the rule "First in, Last out." This signifies that POP would take out the most recent item inserted. For example, the first POP in this stack would remove R from the stack.
On the other hand, Queues use the rule "First in, First out." This signifies that POP would take out the thing in the first "slot." In this case, the first POP in the above queue would remove F, unlike the R it would remove if it was a Stack.
-------------------------------------------------------------------------------------------------------------------------
i was never good at this part of this it might suck
A tree has these features. The "root" is the first node, its "children" is the following few nodes.
Take the Example, ACSL
A is the top and Z is the bottom when it comes to higher and lower
A is our first letter, so it starts as the root of our tree.
C is "less" or "lower" than A alphabetically, so it goes to the right of the parent.
S is "lower" than C and A on the alphabet, so it goes to the right of C.
L is "higher" than S on the alphabet, but "lower" than A and C, so it goes to the left of S.
And that is our Binary Search Tree of ACSL.
I'm going to make a funny joke, so we are going to make a Binary Search tree of "Amogus"
Our first step is to set A as our parent node.
Then we continue with the same logic as always.
M is "lower" on the alphabet than A, so it goes to the right of A.
O is "lower" than both A and M, so it goes to the right of M.
G is "lower" than A, but "higher" than M, so it goes to the left of M.
The Binary Search tree should look like this when you're done:
I didn't mention everything, so if you're confused about something, let me know in the comments.
--------------------------------------------------------------------------------------------------------------------
Priority Queues
I'm actually not too good with this, so, I suggest you look it up or make the slides that I hope Tyler made.
Now for the actual HW part: 1.
2 & 3.
E
A,B,E,O,W,W
3. T
E
O, B, E, A
T
1. E
2. A,B,E,O
3. T