You are on page 1of 14

A PROJECT REPORT ON

“Perform PUSH and POP operations on stack”


Submitted in partial fulfilment of the requirements of the award of degree
Of
DIPLOMA ENGINEERING
In
Computer Engineering

BY:-
1. Kawade Dnyaneshwari Navanath .
2. Late Sandhya Gorakh .
3. Dahiwadkar Pranita Vijay.

UNDER THE GUIDANCE :


Ms.Wadikar R .A

Swami Vivekanand Institute Of Technology (poly),

Solapur.
CERTIFICATE
The project report entitled “Perform PUSH and POP operations on stack.”.
Submitted by:

1. Kawade Dnyaneshwari Navanath .


2. Late Sandhya Gorakh.
3. Dahiwadkar Pranita Vijay.

is approved for the Diploma of Engineering in Computer from : Swami


Vivekanand Institute Of Technology (poly), Solapur.

Name of Guide Name of H.O.D.


(Ms.Wadikar R.A) (P.U .Waghamare)

Department of Computer Engineering Department of Computer Engineering


Swami Vivekanand Institute Of, Swami Vivekanand Institute Of
Technology(poly), Solapur Technology(poly), Solapur

Examiner Principal
( ) ( S.V Kulakarni)

Place: Solapur
Date:
Annexure II
Evolution Sheet for Micro Project
Academic Year: 2023-24 Name of Faculty: -Ms. Wadikar R.A
Course: - Computer Engineering Course Code: - CO3I
Subject: -Data Structure Using C Subject Code: -22317
rd
Semester:- 3 Scheme: - I
Title of
Perform PUSH and POP operations on stack.
Project: -
COs addressed by the Micro Project:
C01 Implement operations on stack and Queue using array.
Major Learning Outcomes achieved by students by doing the Project:

 Write a C program to PUSH and POP operations on stack


(a)Practical Outcomes: array.

1. Develop an algorithm to perform PUSH and POP operations for the


given item in a Stack.
(b) Unit Outcomes in 2. Convert the given expression from Infix to Prefix/Postfix using
Cognitive domain: Stack.
3. Write steps to evaluate the given expression using the stack.

 Perform basic operation on array.


 Apply different searching and sorting techniques.
(c) Outcomes in
 Implement basic operation on stack and queue using array
Affective Domain:
representation.
 Implement basic operations on linked list.
 Implement program to create and traverse tree to solve problem.

Comments/Suggestions about teamwork/leadership/inter-personal communication (if any)

Marks out Marks out


of 6 for of 4 for
Total marks
Enrollment no. Name of student performan performance in
out of 10
ce in group oral/Presentatio
activity n
2212140112 Kawade Dnyaneshwari Navanath

2212140113 Late Sandhya Gorakh.

2212140116 Dahiwadkar Pranita Vijay.


Singnature :
Name &
Signature of Name:
faculty
ACKNOWLEDGEMENT
I take this opportunity to express my sincere thanks and deep sense of
gratitude to my guide Ms.Wadikar.R. ,for constant support, motivation,
valuable guidance and immense help during the entire course of this work.
Without constant encouragement, timely advice and valuable discussion, it
would have been difficult in completing this work. I would also like to
acknowledge Computer Engineering department who provided me the
facilities for completion of the project. I am thankful for sharing to
experienced in research field with me and providing constant motivation
during entire project work

SUBMITTED BY:

Names of Group Enrollment


Members No.

Kawade Dnyaneshwari Nvanath.


2212140113

Late Sandhya Gorakh.


2212140113

Dahiwadkar Pranita Vijay.


2212140116
A MICRO PROJECT ON "Perform PUSH and POP operations on stack."

1.0 Aims/Benefits of the micro project


Data structure is an important aspect for Computer Engineering Diploma graduates. The data
structure is a logical & mathematical model of storing & organizing data in a particular way in a computer.
The methods and techniques of Data Structures are widely used in industries. After learning this subject
students will be able to identify the problem, analyze different algorithms to solve the problem & choose the
most appropriate data structure to represent the data.

2.0 Course outcome addressed.


1) Perform basic operations on the array
2) Apply different searching and sorting techniques
3) Implement basic operations on the queue using array representation.

3.0 Proposed methodology


1. Focused on the selection of an appropriate topic for the micro-project.
2. Select the topic i.e. To Prepare a report on the stack in c programming.
3. Brief study on our topic.
4. Gather all information based on the topic of the micro project.
5. Analysis and study of our topic in detail.
6. Following all the above methodologies we successfully completed our microproject

4.0 Resources used

Sr. no. Name of resource material Specifications Quantity

1 Computer System 4 GB RAM, Windows 11 OS 1

2 Internet Youtube

1
3 textbook/manual DSU 22317 Data Structures Using C
5.0 Brief Introduction/Rationale
In C, a Stack is a linear data structure that obeys the LIFO (Last In First Out) approach to conduct a series of
basic operations like push, pop, peeks, and traverse. A Stack can be executed utilizing an Array or Linked
List.

A Stack is an abstract linear data structure operating as a group of elements that are inserted (push operation)
and withdrawn (pop operation) according to the Last in First Out (LIFO) approach. Insertion and deletion
occur on the same end (top) in a Stack. The top of the stack is returned utilizing the peek operation.

What is the Stack Data Structure in C?

In C, the Stack data structure is an ordered, linear series of items. It is a LIFO (Last In First Out) data
structure, which means that we can insert or withdraw an item at the top of the stack only. It is a sequential
data type, unlike an array. In an array, we can access any of its elements utilizing indexing, but we can only
access the topmost element in a stack. The name "Stack" for this data structure comes from the metaphor of
a set of physical items stacked on top of each other. An example of this data structure would be a stack of
plates: We can only add a plate to the top of the stack and take a plate from the top of the stack. A stack of
coins or a stack of books can also be a real-life example of the stack data structure.

Introduction:
Stack is linear data structure where elements are inserted and deleted at one end that end is called as top of
the stack. As elements are inserted and deleted from top so it is called as last in first out (LIFO) structure.
Stack Terminology:
1)Stack:-It is linear data structure where elements are inserted and deleted at the same end.
2)Top:-The end where elements are inserted and deleted is called as top.
3)max:-It is the maximum size of stack.
4)overflow:-It is the condition which occurs when an element is added to the stack which is already
full.
5)underflow:- It is the condition which occurs when an element is deleted from the stack which is already
empty.
6)push():-The process of adding element to the stack is called as push.
7)pop():-The process of deleting element from the stack is called as pop.

Memory Representation of stack:-


Stack is represented using array and linked list.
Array representation is static which means that size if stack is fix.To do this we maintain a linear array int
st[7],a pointer variable max is used for maximum number of elements held by stack . Initially stack is empty
which is indicated by top=-1.

When stack is not full we can add elements to the stack which is called as push, where top is incremented by
1.
When stack is not empty we can remove elements from the top of stack which is called as pop. After every
pop operation top is decremented by 1.

Operations
on stack:-
1)Is empty:-In this operation we are going to check wether stack is empty or not.
If(top==-1)
{
printf(“Stack is empty”);
}

2)Is full:-In this operation we are going to check whether satck is full or not.
if(top==max-1)
{
printf(“Stack is full”);
}

3)push:-In this operation we are going to add element to stack if stack is not full where after every push
operation top is incremented by 1.
Algorithm:-
1.Start
2.Check stack is full or not
if(top==max-1)
write “Stack is overflow”
3.else
Accept element from user.
++top;
St[top]=ele;
4.Stop.

4)pop:-In this operation we going to delete element from stack if stack is not empty.
Algorithm:-
1.Start
2.Check is stack is empty or not
if(top==-1)
{
Write “Stack Underflow”;
}
3.else
Decrement top by 1
--top;
4.Stop.

Applications of stack:-
1) Reversing string list
2) Polish Notations
3) Recursion
4) Tower of Hanoi

Execution
Stacks can be described using structures, pointers, arrays, or linked lists.

Here, We have executed stacks using arrays in C.

Program:
#include<stdio.h>

#include<conio.h>

#include<stdlib.h>

# define max 10

int st[max],ele,top=-1,i;

void push()

if(top==max-1)
{

printf(“\n Stack Overflow…”);

else

printf(“\n Enter Elements:-”);

scanf(“%d”,&ele);

++top;

st[top]=ele;

void pop()

{
if(top==-1)

printf(“\n Stack Underflow….”);

else

printf(“\n Deleted Element:-%d”,st[top]);

--top;

void display()

if(top==-1)

printf(“\n Stack is empty…..”);

else

{
printf(“\n Stack\n”);

for(i=top;i>=0;i--)

{
printf(“%d”,st[i]);

voidmain()
{

int ch;

clrscr();

do

printf(“\n ***Stack Operations***”);

printf(“\n1)push\n2)pop\n3)display\n4)exit\n”);

printf(“\n Enter Your Choice”);

scanf(“%d”,&ch);

switch(ch)

case 1: push();

break;

case 2: pop();

break;

case 3: display();

break;

case 4: exit(0);

break;

}while(ch!=4);

getch();

}
Output:-
 Conclusion:-

Linear data structures maintain their data in an ordered fashion. Stacks works on a LIFO,
last-in first-out, ordering. The operations for a stack are push, pop, and isEmpty, isFull.

 Reference:-

 https://www.scribd.com/document/535215378/DSU-Unit-3-Stack
 https://www.msbtemicroproject.tech/2022/11/DSU-22317-Data-Structures-Using-C-Microproject-
Computer-3rd-semester.html

You might also like