If debugging is the process of removing bugs, then programming must be the process of putting them in. Edsger W. Dijkstra
The stack is a data structure which store the element using last in first out order (LIFO). The stack can be implemented using Arrays and Linked list. The elements are interspersed between each stack. When element removed from one stack, the array should manage the gaps between the elements.
Write a program to implement three stacks in a single array. The program can use an array to store three stacks.
Push to Stack 1 :12 Push to Stack 1 :48 Push to Stack 1 :86 Push to Stack 2 :45 Push to Stack 2 :23 Push to Stack 2 :34 Push to Stack 3 :9 Push to Stack 3 :67 Push to Stack 3 :22 Pop from Stack 1 : 86 Pop from Stack 1 : 48 Pop from Stack 1 : 12 Pop from Stack 2 : 34 Pop from Stack 2 : 23 Pop from Stack 2 : 45 Pop from Stack 3 : 22 Pop from Stack 3 : 67 Pop from Stack 3 : 9