Posts

Implementing Stack in C++ || Data Structure

Image
How Browser maintains multiple pages using  the Forward and Backward buttons? There are multiple ways through which we can make a similar system that will work like browsers forward and backward buttons. Here I'm going to make this system using the  STACK data structure. Now we will learn what is the  stack? Stack A  stack  is a conceptual structure consisting of a set of homogeneous elements and is based on the principle of last in first out (LIFO). For example, let's think about a stack of books. If we need a book from the middle of it we can not just take that book. In order to take that particular book, we have to go through from the top to the particular book one by one. It means we can pick the last book we placed on that stack of books. It follows the LIFO(Last in First out) order. In easy language -  Stack is a data structure where we can put our data on the top and pick the data also from the top. In order to solve the problem, we need two stacks one for the Backward b