Stacks are essentially lists with a specific way of adding and removing items. Discover how we can build and implement a stack in nearly any programming language with a struct and resizable array.
- [Instructor] So how can we use stacks in programming?…Well, we could use the stack data structure…to represent a card deck in a card game.…In the game the deck of cards would be shuffled…so that a series of cards are stacked on top of each other.…After assembling the card deck, players would each…draw a card from the top of the stack,…or we could also say that the stack would pop off the cards.…Now how would this work in code?…Well, some languages give you stack functionality…out right, but with others, you have to use the tools…given from the language to implement your own stack.…
Stacks are essentially an ordered list with a…specific way of adding and removing items.…You can only add and remove from the top.…With this in mind, we are going to implement…our own stack from scratch in Swift using…a mutable or re-sizeable array, since stacks…are currently not available out right in Swift.…Let's jump in and check it out.…Just like in Java, this class keyword is saying…we are going to create a container.…It's going to be a blue print for how we will…
- Data types: Booleans, numbers, strings, and more
- Multidimensional arrays
- Jagged arrays
- Search and sort arrays
- Linked lists
- Stacks and queues
- Hash functions and hash tables
- Trees and graphs
Skill Level Intermediate
Understand data structures1m 25s
1. Introduction to Data Structures
4. Stacks and Queues
5. Hash-Based Data Structures
6. Trees and Graphs
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.