It follows the LIFO pattern, which means that the value entered first will be removed last. When we perform the delete operation on the stack, there is only one way for entry and exit as the other end is closed. The stack gets filled up from the bottom to the top. In the above cases, we can observe that it goes from the top to the bottom when we were entering the new element in the stack. Since our stack is full as the size of the stack is 5. We have taken the stack of size 5 as shown below in which we are pushing the elements one by one until the stack becomes full. Suppose we want to store the elements in a stack and let's assume that stack is empty. As we can observe in the below figure there are five memory blocks in the stack therefore, the size of the stack is 5. It is a data structure that follows some order to insert and delete the elements, and that order can be LIFO or FILO. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |