SlideShare ist ein Scribd-Unternehmen logo
1 von 8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Stack ‘Data Structure’ {
< Name: Emroz Sardar
Roll no. 000XXX
Department : Electrical Engineering
Section:C Semester: 5th
Subject:DATA STRUCTURE AND ALGORITHM (OE-EE501A)
>
Data Structure And Algorithm
[with Static Implementation]
}
Stack.c Implementation.obj
Electrical Engineering Department
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Data Structure And Algorithm
Stack.c Implementation.obj
Electrical Engineering Department
Introduction; {
[STACK IN DATA STRUCTURE]
‘A stack is a conceptual structure consisting of a set of
homogeneous elements and is based on the principle of last
in first out (LIFO)’
<p> A pile of books, a stack of dinner plates, a box
of pringles potato chips can all be thought of
examples of stacks. The basic operating principle is
that last item you put in is first item you can take
out </p>
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Data Structure And Algorithm
Stack.c Implementation.obj
Electrical Engineering Department
PUSH Operation
POP Operation
<Push operation refers to inserting an element in the stack. Since
there’s only one position at which the new element can be inserted—Top of
the stack, the new element is inserted at the top of the stack.>
<Pop operation refers to the removal of an element. Again,
since we only have access to the element at the top of the
stack, there’s only one element that we can remove. We just
remove the top of the stack.>
Operation on Stack in ‘Data Structure’
{
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Data Structure And Algorithm
Stack.c Implementation.obj
Electrical Engineering Department
Stack ‘Implementation’ {
<Static array Parenthesis checker> <Dynamic arrays Graphical region fill>
Stack implementation in two way:
Static Implementation: these implementation uses arrays to create
stack. Static implementation though a very simple technique but
is not a flexible way of creation as the size of stack has to be
declared during program design after that can not be varied.
Static implementation is not too efficient with respect to memory
utilization.
Dynamic implementation: these implementation is also called link
list implementation and uses pointer to implement the stack type
of data structure.
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Working of Stack “Data Structure” {
Data Structure And Algorithm
Stack.c Implementation.obj
Electrical Engineering Department
The operations work as follows: A pointer called TOP is used to keep track of
the top element in the stack.
When initializing the stack, we set its value to -1 so that we can check if
the stack is empty by comparing TOP == -1.
On pushing an element, we increase the value of TOP and place the new element
in the position pointed to by TOP.
On popping an element, we return the element pointed to by TOP and reduce its
value. Before pushing, we check if the stack is already full
Before popping, we check if the stack is already empty
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Data Structure And Algorithm
Stack.c Implementation.obj
Electrical Engineering Department
Although stack is a simple data structure to implement, it is very
powerful. The most common uses of a stack are:
To reverse a word - Put all the letters in a stack and pop them
out. Because of the LIFO order of stack, you will get the letters
in reverse order.
In compilers - Compilers use the stack to calculate the value of
expressions like 2 + 4 / 5 * (7 - 9) by converting the expression
to prefix or postfix form.
In browsers - The back button in a browser saves all the URLs you
have visited previously in a stack. Each time you visit a new page,
it is added on top of the stack. When you press the back button,
the current URL is removed from the stack, and the previous URL is
accessed.
Stack ‘Application’ {
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Data Structure And Algorithm
Stack.c Implementation.obj
Electrical Engineering Department
Alternative ‘Resources’ {
● https://www.programiz.com/dsa/stack
● https://www.tutorialspoint.com/data_structures_algorithms/sta
ck_algorithm.htm
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Data Structure And Algorithm
Stack.c Implementation.obj
Electrical Engineering Department
Thanks; {
<9804226160>
‘Do you have any questions?’
}
‘supermanemroz@gmail.com’

Weitere ähnliche Inhalte

Ähnlich wie Stack Data Structure with Static Implementation (2).pptx

Objectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxObjectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxdunhamadell
 
Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9Getachew Ganfur
 
Unit 1_Stack and Queue using Linked Organization.pdf
Unit 1_Stack and Queue using Linked Organization.pdfUnit 1_Stack and Queue using Linked Organization.pdf
Unit 1_Stack and Queue using Linked Organization.pdfKanchanPatil34
 
Stacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti AroraStacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti Arorakulachihansraj
 
Stacks & Queues
Stacks & QueuesStacks & Queues
Stacks & Queuestech4us
 
Stacks
StacksStacks
StacksAcad
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfkarymadelaneyrenne19
 
Chapter 4 stack and queue
Chapter 4 stack and queueChapter 4 stack and queue
Chapter 4 stack and queueMuhammadBakri13
 
stack_presentaton_HUSNAIN[2].pojklklklptx
stack_presentaton_HUSNAIN[2].pojklklklptxstack_presentaton_HUSNAIN[2].pojklklklptx
stack_presentaton_HUSNAIN[2].pojklklklptxHusnainNaqvi2
 
lect- 3&4.ppt
lect- 3&4.pptlect- 3&4.ppt
lect- 3&4.pptmrizwan38
 
stack & queues .pptx
stack & queues .pptxstack & queues .pptx
stack & queues .pptxkaishsahu
 
Array stack-queue1
Array stack-queue1Array stack-queue1
Array stack-queue1Rajendran
 
Unit 5 Java Programming with Linux-converted.pdf
Unit 5 Java Programming with Linux-converted.pdfUnit 5 Java Programming with Linux-converted.pdf
Unit 5 Java Programming with Linux-converted.pdfranjithunni35
 

Ähnlich wie Stack Data Structure with Static Implementation (2).pptx (20)

Objectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxObjectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docx
 
Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9
 
Rana Junaid Rasheed
Rana Junaid RasheedRana Junaid Rasheed
Rana Junaid Rasheed
 
Unit 1_Stack and Queue using Linked Organization.pdf
Unit 1_Stack and Queue using Linked Organization.pdfUnit 1_Stack and Queue using Linked Organization.pdf
Unit 1_Stack and Queue using Linked Organization.pdf
 
2 b queues
2 b queues2 b queues
2 b queues
 
Stacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti AroraStacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti Arora
 
Stacks & Queues
Stacks & QueuesStacks & Queues
Stacks & Queues
 
STACK.pptx
STACK.pptxSTACK.pptx
STACK.pptx
 
Stacks
StacksStacks
Stacks
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
 
Chapter 4 stack and queue
Chapter 4 stack and queueChapter 4 stack and queue
Chapter 4 stack and queue
 
Les12[1]Creating Views
Les12[1]Creating ViewsLes12[1]Creating Views
Les12[1]Creating Views
 
stack_presentaton_HUSNAIN[2].pojklklklptx
stack_presentaton_HUSNAIN[2].pojklklklptxstack_presentaton_HUSNAIN[2].pojklklklptx
stack_presentaton_HUSNAIN[2].pojklklklptx
 
lect- 3&4.ppt
lect- 3&4.pptlect- 3&4.ppt
lect- 3&4.ppt
 
stack & queues .pptx
stack & queues .pptxstack & queues .pptx
stack & queues .pptx
 
Sorting_project_2.pdf
Sorting_project_2.pdfSorting_project_2.pdf
Sorting_project_2.pdf
 
DataBase Management System Lab File
DataBase Management System Lab FileDataBase Management System Lab File
DataBase Management System Lab File
 
Array stack-queue1
Array stack-queue1Array stack-queue1
Array stack-queue1
 
Unit 5 Java Programming with Linux-converted.pdf
Unit 5 Java Programming with Linux-converted.pdfUnit 5 Java Programming with Linux-converted.pdf
Unit 5 Java Programming with Linux-converted.pdf
 
104332 sri vidhya eng notes
104332 sri vidhya eng notes104332 sri vidhya eng notes
104332 sri vidhya eng notes
 

Kürzlich hochgeladen

Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Industrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptIndustrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptNarmatha D
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsDILIPKUMARMONDAL6
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 

Kürzlich hochgeladen (20)

Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Industrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptIndustrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.ppt
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teams
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 

Stack Data Structure with Static Implementation (2).pptx

  • 1. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Stack ‘Data Structure’ { < Name: Emroz Sardar Roll no. 000XXX Department : Electrical Engineering Section:C Semester: 5th Subject:DATA STRUCTURE AND ALGORITHM (OE-EE501A) > Data Structure And Algorithm [with Static Implementation] } Stack.c Implementation.obj Electrical Engineering Department
  • 2. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Data Structure And Algorithm Stack.c Implementation.obj Electrical Engineering Department Introduction; { [STACK IN DATA STRUCTURE] ‘A stack is a conceptual structure consisting of a set of homogeneous elements and is based on the principle of last in first out (LIFO)’ <p> A pile of books, a stack of dinner plates, a box of pringles potato chips can all be thought of examples of stacks. The basic operating principle is that last item you put in is first item you can take out </p> }
  • 3. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Data Structure And Algorithm Stack.c Implementation.obj Electrical Engineering Department PUSH Operation POP Operation <Push operation refers to inserting an element in the stack. Since there’s only one position at which the new element can be inserted—Top of the stack, the new element is inserted at the top of the stack.> <Pop operation refers to the removal of an element. Again, since we only have access to the element at the top of the stack, there’s only one element that we can remove. We just remove the top of the stack.> Operation on Stack in ‘Data Structure’ { }
  • 4. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Data Structure And Algorithm Stack.c Implementation.obj Electrical Engineering Department Stack ‘Implementation’ { <Static array Parenthesis checker> <Dynamic arrays Graphical region fill> Stack implementation in two way: Static Implementation: these implementation uses arrays to create stack. Static implementation though a very simple technique but is not a flexible way of creation as the size of stack has to be declared during program design after that can not be varied. Static implementation is not too efficient with respect to memory utilization. Dynamic implementation: these implementation is also called link list implementation and uses pointer to implement the stack type of data structure. }
  • 5. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Working of Stack “Data Structure” { Data Structure And Algorithm Stack.c Implementation.obj Electrical Engineering Department The operations work as follows: A pointer called TOP is used to keep track of the top element in the stack. When initializing the stack, we set its value to -1 so that we can check if the stack is empty by comparing TOP == -1. On pushing an element, we increase the value of TOP and place the new element in the position pointed to by TOP. On popping an element, we return the element pointed to by TOP and reduce its value. Before pushing, we check if the stack is already full Before popping, we check if the stack is already empty }
  • 6. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Data Structure And Algorithm Stack.c Implementation.obj Electrical Engineering Department Although stack is a simple data structure to implement, it is very powerful. The most common uses of a stack are: To reverse a word - Put all the letters in a stack and pop them out. Because of the LIFO order of stack, you will get the letters in reverse order. In compilers - Compilers use the stack to calculate the value of expressions like 2 + 4 / 5 * (7 - 9) by converting the expression to prefix or postfix form. In browsers - The back button in a browser saves all the URLs you have visited previously in a stack. Each time you visit a new page, it is added on top of the stack. When you press the back button, the current URL is removed from the stack, and the previous URL is accessed. Stack ‘Application’ { }
  • 7. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Data Structure And Algorithm Stack.c Implementation.obj Electrical Engineering Department Alternative ‘Resources’ { ● https://www.programiz.com/dsa/stack ● https://www.tutorialspoint.com/data_structures_algorithms/sta ck_algorithm.htm }
  • 8. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Data Structure And Algorithm Stack.c Implementation.obj Electrical Engineering Department Thanks; { <9804226160> ‘Do you have any questions?’ } ‘supermanemroz@gmail.com’