Reverse String using Stack

 

Stack is LIFO(LAST IN FIRST OUT) linear data structure. It can have 2 operations 1)Push(add a new item)  2)Pop(delete an item).In this example I have shown how  to reverse a string from last character to the first (example…..RAM  OUTPUT IS MAR)

Program of stack using linked list

Two basic methods used in stack(LIFO….Last In First Out) are: statically (Array based implementation) and dynamically(pointer-based(Linked List) implementation).

Program of stack using array

There are two basic methods for the implementation of stacks--- one where the memory is used statically(by using Array) and the other where the memory is used dynamically(by Linked List).

About Us

Rekha SetiaRekha Setia is a passionate blogger of Extra Computer Notes. if you have any ideas or any request me @