Algorithm Book - Chapter 6 - Queues and Stacks Flashcards

1
Q

What is a data structure?

A

When we create software systems, we make choices about how to store and organize information, and these choices significantly impact the performance of our systems.

It is always wise to borrow great ideas from the past, and over time well-known patterns have emerged for storing, managing, and retriveing information. These patterns are refelcted in reuseable code called data structures.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe the mechanics of a data structure?

A

Put simply, data structures handle data - they store, organize, and retrieve information. THere are many different data structure; each exists because it is optimized for a certain set of usage scenarios.

EACH DATA STRUCTURE HAS ITS OWN PRIORITIES ABOUT WHAT ASPECTS ARE IMPORTANT.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are factors to consider with a data structure?

A

How the data structure consumes memory, which of its functions it expects to be most frequently called, etc. Understanding these tradeoffs enables you to make intentional decisions about which data structure to use in your particular situation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an abstract data type and what is a queue?

A

The outward behavior of the data structure is well understood, but there is no requrement on how the data structure is constructed internally. We could choose to reimplement an existing Abstract data type in an entierly different manner, as long as we maintain the same abstract integerface.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Queue

A

This.head and this.tail…you need to know the front and the end

Arrays can be used to be LIKE a stack, since the last value van be popped or pushed. HOWEVER, you would need to make it a var…instead of this, so there would be no manipulation of the array within the class

This.HEAD for a stack…we can add to the linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

NOTE: How to append an html_element?

A

{{html_element | safe}}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly