Swipe to navigate through the chapters of this book
Stacks, whose property is known as last-in, first-out or LIFO, is introduced and implemented using arrays. Some of the common operations for stacks such adding and removing an item, push and pop, are discussed. Using stacks, elements in the list can easily be reversed and strings can be checked for a palindrome. Further, prefix and postfix expressions are discussed where postfix expressions can be evaluated using stacks.