You are on page 1of 15

KENNEDY ROAD, NEAR R.T.O.

, PUNE 411001
Institute Code: 0141

Implement stack using linked list.


Academic Year: 2020-21 Program Code: CO3I
Course: DSU Course Code: 22317

Submitted By:

Roll No Student Name Branch Batch Sign of Student

Under Guidance of:


Mrs. P. P. Bastawade

1
KENNEDY ROAD, NEAR R.T.O., PUNE 411001
Institute Code: 0141
CERTIFICATE

Certified that this micro project report titled “Implement stack using linked list.” is
the bonafide work of Ms./Mr. Roll. no. 150, 158, 159 of second year diploma in
Computer engineering for the course: Data Structure using C Course code: 22317
during the academic year 2020-21, who carried out the micro project work under my
supervision.

Name & signature of Subject teacher

2
ALL INDIA SHRI SHIVAJI MEMORIAL SOCIETY’S POLYTECHNIC, PUNE -1

COMPUTER ENGINEERING DEPARTMENT


VISION AND MISSION OF THE INSTITUTE

 VISION:
Achieve excellence in quality technical education by imparting knowledge, skills and abilities to
build a better technocrat.

 MISSION:
M1: Empower the students by inculcating various technical and soft skills.

M2: Upgrade teaching-learning process and industry-institute interaction

VISION AND MISSION OF THE COMPUTER DEPARTMENT


 VISION:
“Enhance skills by providing value based technical education for fulfilling global needs in the field
of computer engineering.”

 MISSION:
M1: To provide quality education in computer engineering by improving
psychomotor skills.

M2: To develop positive attitude, communication skills, team spirit


and entrepreneurship.

M3: To develop awareness about societal and ethical responsibility for


professionalism.

3
ALL INDIA SHRI SHIVAJI MEMORIAL SOCIETY’S POLYTECHNIC, PUNE -1

COMPUTER ENGINEERING DEPARTMENT

PROGRAM OUTCOMES (POs)

PO1 Basic and Discipline specific knowledge: Apply knowledge of basic mathematics, science
and engineering fundamentals and engineering specialization to solve the engineering problems.

PO2 Problem analysis: Identify and analyze well-defined engineering problems using codified
standard methods.

PO3 Design/ development of solutions: Design solutions for well-defined technical problems and
assist with the design of systems components or processes to meet specified needs.

PO4 Engineering Tools, Experimentation and Testing: Apply modern engineering tools and
appropriate technique to conduct standard tests and measurements.

PO5 Engineering practices for society, sustainability and environment: Apply appropriate
technology in context of society, sustainability, environment and ethical practices.

PO6 Project Management: Use engineering management principles individually, as a team member
or a leader to manage projects and effectively communicate about well-defined engineering
activities.

PO7 Life-long learning: Ability to analyze individual needs and engage in updating in the context of
technological changes.

PROGRAM SPECIFIC OUTCOMES (PSO)

The Diploma in Computer Engineering will prepare students to attain:

 PSO 1: Apply computing knowledge with standard practices to develop software.


 PSO 2: Maintain Computer Hardware and Software System

4
INDEX

Sr. No. Content Page No.

1. Annexure I 6-8

2. Micro Project Proposal 6-8

3. Annexure II 9-10

4. Rationale 9

5. Aims/Benefits of the Micro Project 9

6. Course Outcome achieved 9

7. Literature Review 9

8. Actual Methodology Followed 10

9. Actual Resources Used 10

10. Output of the Micro Projects 10-15

11 Skill Developed / Learning outcome of the Micro 15


Project

12. Applications of the Micro Project 15

13. Annexure III 16

14. Annexure IV (Evaluation Sheet) 17-19

15. Log book 20

5
ANNEXURE I

Micro Project Proposal

“Implement stack using linked list”


1.0 Aims/Benefit of the Micro Project (Minimum 30-50 Words):
1. It helps to learn that how to use the concept of linked list to implement stack.
2. It helps to develop programming skills.
3. It increases skill for developing programs using data structure concepts.

2.0 Course Outcomes Addressed:


a. Perform basic operations on arrays.
b. Apply different searching and sorting techniques.
c. Implement basic operations on stack and queue using array representation.
d. Implement basic operations on linked list.
e. Implement program to create and transverse tree to solve problems.

3.0 Proposed Methodology (Procedure that will be followed to do the micro project- in about
100-200 words):
a. Select one topic for micro project that you find very simple.
b. Consult with your teacher for finalization of topic.
c. Make draft copy of micro project proposal.
d. Take approval from teacher.
e. Make list of resources required such as raw material, instruments, software.
f. Execute Micro project.
g. Test Micro project.
h. Observe outputs/Results of Micro project.
i. Prepare Micro Project Presentation.
j. Prepare Micro project report for submission

6
4.0 Action Plan:

Sr. Details of Activity Planned Planned Name of Responsible


No. Start Date Finish Team Members
Date
1 Formation of groups 18.08.2020 20.08.2020

2 Selected the topic for micro 20.08.2020 21.8.2020


project

3 Discussed about the project 24.08.2020 26.08.2020

4 Assigned the work to each 26.08.2020 27.08.2020


group member

5 Detailed study of micro- 28.08.2020 01.09.2020


project
6 Collected information on 02.09.2020 05.0.9.202
assignment topic 0

7 Started working on micro- 07.09.2020 14.09.2020


project

8 Assembled all the data 22.09.2020 24.09.2020

9 Evaluation of data 25.09.2020 30.09.2020

10 Prepared rough copy of micro- 01.10.2020 05.10.2020


project

11 Project proposal presentation 06.10.2020 08.10.2020


to guide

12 Corrected the micro-project 12.10.2020 13.10.2020


suggested by guide

13 Actual implementation of 23.10.2020 27.10.2020


micro-project

14 Execution of overall data / 03.11.2020 06.11.2020


prepared final draft copy

15 Final micro-project 09.11.2020 12.11.2020


presentation
16 Micro-project submitted 24.11.2020 27.11.2020

7
5.0 Resources Required

Sr. Name of Specifications Quantity Remarks


No. Resource/material
1 Computer system Any desktop or laptop one system
computer with basic
configuration
2 Office software package MS office, Turbo C++
version 3.0, Dev C++
3 Printer inkjet or laser printer one printer

Name of Team Members with Roll No’s:

Sr. No. Name of the Student Roll No.

1.

2.

3.

Mrs. P. P. Bastawade
(Name & Signature of faculty)

8
ANNEXURE - II

Micro Project Report

“Implement stack using linked list”


1.0 Rationale (Importance of the project, in about 30 to 50 Words.):
A stack can be easily implemented through the linked list. In stack Implementation, a stack
contains a top pointer i.e., “head” of the stack where pushing and popping items happens at
the head of the list. First node has null in link field and second node link have first node
address in link field and so on and last node address in “top” pointer.
The main advantage of using linked list over an array is that it is possible to implements a
stack that can shrink or grow as much as needed. In using array will put a restriction to the
maximum capacity of the array which can lead to stack overflow. Here each new node will be
dynamically allocated. so, overflow is not possible.

2.0 Aims/Benefits of the Micro Project:


1. It helps to learn that how to use the concept of linked list to implement stack.
2. It helps to develop programming skills.
3. It increases skill for developing programs using data structure concepts.

3.0 Course Outcomes Achieved:


a. Implement basic operations on stack and queue using array representation.
b. Implement basic operations on linked list.

4.0 Literature Review:


Stack consists of a top pointer which is called the head.
The key operations such as push () and pop () take place at the head. In the link field, the
first node has a null value while the second node contains the address of the first node in its
link field.
 Steps in Push () Operation in Stack Using Linked List
Create a new node and allocate it a memory. In case the list is empty, the item that is to be
pushed would become the head node of the stack. To the newly created node, assign the
item value to the data field, and assign null to the next field which has the address. In case
the list already has some nodes, we would still have to add the newly created node to the top
end of the stack so as to maintain the LIFO working procedure of stacks. So here, we would
assign the address of the first element in the existing list to the new node’s address field and
assign the item value to the new node’s data field. Thus, this newly created node would
become the head node of the linked list
 Steps in Pop () Operation in Stack Using Linked List
Check if the list is empty first. This process is called checking for underflow conditions. As
you check, when the head node points to null in the linked list, you can derive that the list is
empty and that no element can be popped from the stack. If the list has some existing
values, then you can pop out the topmost element. So, here you delete the head node and
free it. Then the second node now becomes the head node.
One of the main advantages of a stack using linked list over arrays is that it is
feasible to make a stack grow or shrink as per the needs of the user. However, in an array, a
constraint is fixed to restrict the maximum capacity to which the stack can overflow.

9
5.0 Actual Methodology Followed: (Write stepwise work done, data collected and its analysis (if
any). The contribution of individual member may also be noted.) :

Firstly, we have finalized the topic, then prepared a micro project proposal. We distributed
the work as per the requirements of projects. Then some group members had collected a
brief information about the project and shared with the group. Then all of us started the
work which was distributed to the respective member of the group. After that we confirmed
all the work we have done. Then the members which were given the work of arranging the
information, they started to compose the project as per the standard format. After arranging
and formatting the information we had taken review from the teacher. As per the
suggestions of the teacher again the respective members started editing the project. The
project is verified in two steps procedure one verified by the group members and secondly
by the subject teacher. The project was finally send for final checking and editing, just to be
presented in hardcover media as printouts.

6.0 Actual resources required:

Sr. Name of Specifications Quantity Remarks


No Resource/material
.
1 Computer system Any desktop or laptop One system
computer with basic
configuration
2 Office software MS office, Turbo C++
package version 3.0, Dev C++

3 Printer Inkjet or laser printer One printer

7.0 Outputs of the Micro project (Presentation of data, findings, drawing etc.):
Program:

#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct node
{
int info;
struct node *ptr;
}*top,*top1,*temp;

int topelement();
void push(int data);
void pop();
void empty();
void display();
void destroy();
void stack_count();
void create();

10
int count = 0;

int main()
{
int no, ch, e;

printf("\n 1 - Push");
printf("\n 2 - Pop");
printf("\n 3 - Top");
printf("\n 4 - Empty");
printf("\n 5 - Exit");
printf("\n 6 - Dipslay");
printf("\n 7 - Stack Count");
printf("\n 8 - Destroy stack");

create();

while (1)
{
printf("\n Enter choice : ");
scanf("%d", &ch);

switch (ch)
{
case 1:
printf("Enter data : ");
scanf("%d", &no);
push(no);
break;
case 2:
pop();
break;
case 3:
if (top == NULL)
printf("No elements in stack");
else
{
e = topelement();
printf("\n Top element : %d", e);
}
break;
case 4:
empty();
break;
case 5:
exit(0);
case 6:
display();
break;
case 7:
stack_count();
break;
11
case 8:
destroy();
break;
default :
printf(" Wrong choice, Please enter correct choice ");
break;
}
}
}

/* Create empty stack */


void create()
{
top = NULL;
}

/* Count stack elements */


void stack_count()
{
printf("\n No. of elements in stack : %d", count);
}

/* Push data into stack */


void push(int data)
{
if (top == NULL)
{
top =(struct node *)malloc(1*sizeof(struct node));
top->ptr = NULL;
top->info = data;
}
else
{
temp =(struct node *)malloc(1*sizeof(struct node));
temp->ptr = top;
temp->info = data;
top = temp;
}
count++;
}

/* Display stack elements */


void display()
{
top1 = top;

if (top1 == NULL)
{
printf("Stack is empty");
return;
}

12
while (top1 != NULL)
{
printf("%d ", top1->info);
top1 = top1->ptr;
}
}

/* Pop Operation on stack */


void pop()
{
top1 = top;

if (top1 == NULL)
{
printf("\n Error : Trying to pop from empty stack");
return;
}
else
top1 = top1->ptr;
printf("\n Popped value : %d", top->info);
free(top);
top = top1;
count--;
}

/* Return top element */


int topelement()
{
return(top->info);
}

/* Check if stack is empty or not */


void empty()
{
if (top == NULL)
printf("\n Stack is empty");
else
printf("\n Stack is not empty with %d elements", count);
}

/* Destroy entire stack */


void destroy()
{
top1 = top;

while (top1 != NULL)


{
top1 = top->ptr;
free(top);
top = top1;
top1 = top1->ptr;
}
13
free(top1);
top = NULL;

printf("\n All stack elements destroyed");


count = 0;
}

Output: -

14
8.0 Skill developed / Learning outcome of the Micro-Project:
1. Learnt how to use and apply different types of data structures like stack, queue, linear
search etc. using C.
2. Learnt to implement stack using linked list.
3. Working in a team and as an individual.
4. Developed skills to apply data structure concepts using c.

9.0 Applications of the Micro-Project:


1. It will help to implement the stack with the help of linked list in real world applications.
2. It improves our programming skills.
3. improves knowledge in implementing data structure.

Mrs. P. P. Bastawade
(Name & Signature of faculty)

15

You might also like