LINEAR DATA STRUCTURE : STACK
What is a stack? A stack is a linear data structure in which the addition and deletion of data are done from the same end. This end is often referred to as the top of a stack. Last-In-First-Out (LIFO) structure. STACK ADT: DATA: It is a finite sequence of elements of a particular type. (arrays / linked list) OPERATIONS: 1. Initialize a stack. 2. check whether the stack is empty. 3. check whether the stack is full. 4. Insert at the top of stack if a stack is not full. This operation is called Push. 5. Delete a element from the top of stack if it is not empty. This operation is called Pop. 6. Retrieve an element from the top of stack. This operation is called Peek. STACK OPERATION Implementation of Stack: 1. Using Array 2. Using Linked List. Message Passing Methods in C: 1. Pass by Value / Call by Value. 2. Pass by Address / Call by Address. Implementation of a stack using arrays #include<stdio.h> //pre-processor directive #include<unistd.h> #define MAX 5 str...