Understand Stacks

Learn the basics of stacks and create your own class to implement our stack.

Introduction to stacks

To build the undo functionality for our text editor, we will be using the stack data structure. A stack is a data structure that follows a last-in-first-out policy. It means that the insertion and deletion of the elements from the stack happen from the top (end) of the array. For example, consider a pile of books—if we want to remove one book from the pile of books, we can do so by removing the book first on the top and then the next one, and so on. If we want to add another book to ...

Access this course and 1400+ top-rated courses and projects.