Why Is This

Link to article:
https://www.codecademy.com/courses/learn-data-structures-and-algorithms-with-python/articles/tree-traversal
Look at this:


Why is this:
1:

image

2:
image
image
(I had to use 2 images for each sentence since the sentences are on two different lines(I can only screenshot a square).

Examine the two terms and how they behave. A queue is first on, first off. A stack is last on, first off.

I know but how are queues and stacks suitable for breadth-first search and depth-first search?

It’s in how we build and retrieve the different data structures. One is going across then down, the other is going down then across. That’s as much as I can go into it. The rest is up to you to explain to me.

1 Like

I’m just going to take the articles and lessons to understand it.

1 Like