Algorithm Book - Chapter 6 - Queues and Stacks Flashcards
What is a data structure?
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.
Describe the mechanics of a data structure?
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.
What are factors to consider with a data structure?
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.
What is an abstract data type and what is a queue?
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.
Queue
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
NOTE: How to append an html_element?
{{html_element | safe}}