Stack Queue SubRoutine

IPSITA RAHA | 11500120054
DIBYENDU BANIK | 11500320062
ARNAB PAUL | 11500320075
ARNAB CHATTERJEE | 11500320076
ARIJIT DHALI | 11500320078
STACK, QUEUE
& SUBROUTINE
EC 502
Computer Architecture
Group: 5
CONTENT
1. STACK OVERVIEW
2. QUEUE OVERVIEW
3. APPLICATION OF STACK AND QUEUE
4. SUBROUTINE OVERVIEW
5. SUBROUTINE APPLICATION WITH EXAMPLE
STACK
• Stack is a linear data structure which follows a particular
order in which the operations are performed. The order may
be LIFO(Last In First Out) or FILO(First In Last Out).
• Insertion and deletion takes place at one end.
Example :
Plates stacked over one another in canteen
Top
Push Pop
QUEUE
• A Queue is a linear structure which follows a particular
order in which the operations are performed. The order
is First In First Out (FIFO).
• Insertion takes place at the rear end, and deletion takes
place at the front end.
Example :
Customers standing in a line at canteen
Front
Rear
Enqueue
Dequeue
QUEUE
• Queue is used in solving problems having sequential processing.
• Applied as waiting lists for a single shared resource like CPU, Disk,
Printer.
• Applied as buffers on MP3 players and portable CD players.
• Applied on Operating system to handle interruption.
• Applied to add song at the end or to play from the front.
STACK
• Stack is used in solving problems works on recursion.
• Evaluation of Arithmetic Expressions
• Backtracking
• Delimiter Checking
• Reverse a Data
• Processing Function Calls
APPLICATION OF STACK
AND QUEUE
Stack as well as Queue are used in manipulating the flow of data in a network.
SUB ROUTINE
The block of instruction which carries out a specific and well defined task
is called a subroutine. Moreover, it is a small block of instruction, written
and stored separately.
Working principle of Sub-Routine
1. Halts the main program.
2. Provide returning to the main point.
3. Transfer control is called subroutine.
4. Executes the subroutine.
5. Revert to the main routine.
Program
Start
Subroutine
Call
Rest of
Program
Program
End
Subroutine
Start
Subroutine
Program
Subroutine
End
Main Program
Subroutine
Transfer
Return
SUB ROUTINE
• Decomposing a complex programming task into simpler steps.
• Reducing duplicate code within a program
• Enabling reuse of code across multiple programs
• Dividing a large programming task among various
programmers or various stages of a project
• Hiding implementation details from
• Improving readability of code
• Improving traceability
APPLICATIONS
EXAMPLE
SUBROUTINE
SUB multiply(INT : number)
for i runs 1 to 5
(e.g. for(i=1;i<=5;i++))
OUTPUT number * i
NEXT
END SUB
PROGRAM
INPUT num
CALL multiply(num)
CONCLUSION
• Stacks : A stack is a basic data structure that can be logically thought as
linear structure represented by a real physical stack or pile, a structure
where insertion and deletion of items takes place at one end called top of
the stack.
• Queue : Queue is an abstract data structure, somewhat similar to Stacks.
Unlike stacks, a queue is open at both its ends. One end is always used to
insert data (enqueue) and the other is used to remove data (dequeue).
• Subroutine : Subroutine is a sequence of program instructions that performs
a specific task, packaged as a unit. This unit can then be used in programs
wherever that particular task should be performed.
https://en.wikipedia.org
/wiki/Subroutine
https://www.geeksforge
eks.org/applications-of-
queue-data-structure/
01
02
03
04
05
https://www.quora.com
/
https://www.javatpoint.c
om/applications-of-
stack-in-data-structure
https://www.geeksforge
eks.org/difference-
between-stack-and-
queue-data-structures/
BIBLIOGRAPHY
THANK
YOU!
Group: 5
1 de 10

Recomendados

16-bit microprocessors16-bit microprocessors
16-bit microprocessorsZahra Sadeghi
1.1K vistas39 diapositivas
Quick sortQuick sort
Quick sortDhruv Sabalpara
690 vistas9 diapositivas
Stack organizationStack organization
Stack organizationchauhankapil
14.8K vistas9 diapositivas
Linked listLinked list
Linked listakshat360
85.7K vistas56 diapositivas

Más contenido relacionado

La actualidad más candente(20)

Queue data structureQueue data structure
Queue data structure
anooppjoseph47K vistas
Merge sort algorithm power point presentationMerge sort algorithm power point presentation
Merge sort algorithm power point presentation
University of Science and Technology Chitttagong7.5K vistas
Double Linked List (Algorithm)Double Linked List (Algorithm)
Double Linked List (Algorithm)
Huba Akhtar3.8K vistas
QueueQueue
Queue
Allana Institute of management sciences1.1K vistas
Stack Operation In Data Structure Stack Operation In Data Structure
Stack Operation In Data Structure
DivyeshKumar Jagatiya7.6K vistas
Registers-shift registerRegisters-shift register
Registers-shift register
Bilawal Fiaz1.1K vistas
Merge sortMerge sort
Merge sort
Vidushi Pathak24K vistas
Quick sortQuick sort
Quick sort
amar kakde2.4K vistas
Heap treeHeap tree
Heap tree
Shankar Bishnoi2.1K vistas
Quick sort algorithnQuick sort algorithn
Quick sort algorithn
Kumar 2.6K vistas
Flags registersFlags registers
Flags registers
saman Iftikhar2.6K vistas
Stack and Queue.pptxStack and Queue.pptx
Stack and Queue.pptx
Ddushb26 vistas
Bubble Sort Algorithm Presentation Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation
AhmedAlbutty932 vistas
Emu8086Emu8086
Emu8086
rangarajb200510.9K vistas
External memory - Computer ArchitectureExternal memory - Computer Architecture
External memory - Computer Architecture
Bretz Harllynne Moltio17K vistas
Quick SortQuick Sort
Quick Sort
Shweta Sahu4.7K vistas
Quicksort PresentationQuicksort Presentation
Quicksort Presentation
irdginfo5.3K vistas
stack presentationstack presentation
stack presentation
Shivalik college of engineering8.8K vistas

Similar a Stack Queue SubRoutine

INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMKamran Ashraf
20.8K vistas16 diapositivas
Parallel ProgrammingParallel Programming
Parallel ProgrammingMindfire Solutions
743 vistas14 diapositivas
Unit 4 COA.pptxUnit 4 COA.pptx
Unit 4 COA.pptxAkshatBhatnagar30
19 vistas23 diapositivas

Similar a Stack Queue SubRoutine(20)

1 Introduction to C Programming.pptx1 Introduction to C Programming.pptx
1 Introduction to C Programming.pptx
aarockiaabinsAPIICSE112 vistas
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISM
Kamran Ashraf20.8K vistas
Parallel ProgrammingParallel Programming
Parallel Programming
Mindfire Solutions743 vistas
Unit 4 COA.pptxUnit 4 COA.pptx
Unit 4 COA.pptx
AkshatBhatnagar3019 vistas
Presentation.pdfPresentation.pdf
Presentation.pdf
SamuelSianamate1 vista
Programming Sessions KU Leuven - Session 03Programming Sessions KU Leuven - Session 03
Programming Sessions KU Leuven - Session 03
Rafael Camacho Dejay45 vistas
Unit II -  LINEAR DATA STRUCTURESUnit II -  LINEAR DATA STRUCTURES
Unit II - LINEAR DATA STRUCTURES
Usha Mahalingam377 vistas
2.0 Stacks.pptx2.0 Stacks.pptx
2.0 Stacks.pptx
MuhammadShajid17 vistas
3 Pipelining3 Pipelining
3 Pipelining
fika sweety4K vistas
Plc  part 3Plc  part 3
Plc part 3
Taymoor Nazmy12 vistas
layout planninglayout planning
layout planning
Radhika Itkan15.4K vistas
Chapter One Function.pptxChapter One Function.pptx
Chapter One Function.pptx
miki30475913 vistas
Lec1 finalLec1 final
Lec1 final
Gichelle Amon1.1K vistas
Functional programming in pythonFunctional programming in python
Functional programming in python
Edward D. Weinberger56 vistas
Functional programming in pythonFunctional programming in python
Functional programming in python
Edward D. Weinberger48 vistas
Presentation1(1)Presentation1(1)
Presentation1(1)
Ruthvik Vaila864 vistas
Core pipelining Core pipelining
Core pipelining
Ibrahim Hassan21 vistas

Más de ArijitDhali(20)

Motorola 68020.pdfMotorola 68020.pdf
Motorola 68020.pdf
ArijitDhali240 vistas
Active Filters.pdfActive Filters.pdf
Active Filters.pdf
ArijitDhali289 vistas
Wideband Frequency Modulation.pdfWideband Frequency Modulation.pdf
Wideband Frequency Modulation.pdf
ArijitDhali431 vistas
Celebrity Problem.pdfCelebrity Problem.pdf
Celebrity Problem.pdf
ArijitDhali155 vistas
Biodiversity Hotspots in IndiaBiodiversity Hotspots in India
Biodiversity Hotspots in India
ArijitDhali6.6K vistas
LTI Systems - With/Without MemoryLTI Systems - With/Without Memory
LTI Systems - With/Without Memory
ArijitDhali504 vistas
RLC Series ResonanceRLC Series Resonance
RLC Series Resonance
ArijitDhali168 vistas
Bivariate Discrete DistributionBivariate Discrete Distribution
Bivariate Discrete Distribution
ArijitDhali421 vistas
Solar CellSolar Cell
Solar Cell
ArijitDhali99 vistas
Barcode DecoderBarcode Decoder
Barcode Decoder
ArijitDhali167 vistas
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
ArijitDhali805 vistas
Conditional ProbabilityConditional Probability
Conditional Probability
ArijitDhali376 vistas
Space Solar PowerSpace Solar Power
Space Solar Power
ArijitDhali87 vistas
Types of function callTypes of function call
Types of function call
ArijitDhali371 vistas
Diffraction interferenceDiffraction interference
Diffraction interference
ArijitDhali122 vistas

Último(20)

Wire Cutting & StrippingWire Cutting & Stripping
Wire Cutting & Stripping
Iwiss Tools Co.,Ltd6 vistas
SNMPxSNMPx
SNMPx
Amatullahbutt12 vistas
Stone Masonry and Brick Masonry.pdfStone Masonry and Brick Masonry.pdf
Stone Masonry and Brick Masonry.pdf
Mohammed Abdullah Laskar19 vistas
Wire RopeWire Rope
Wire Rope
Iwiss Tools Co.,Ltd8 vistas
FLOW IN PIPES NOTES.pdfFLOW IN PIPES NOTES.pdf
FLOW IN PIPES NOTES.pdf
Dearest Arhelo85 vistas
PlumbingPlumbing
Plumbing
Iwiss Tools Co.,Ltd11 vistas
Solar PVSolar PV
Solar PV
Iwiss Tools Co.,Ltd11 vistas
SWM L1-L14_drhasan (Part 1).pdfSWM L1-L14_drhasan (Part 1).pdf
SWM L1-L14_drhasan (Part 1).pdf
MahmudHasan74787044 vistas
Deutsch CrimpingDeutsch Crimping
Deutsch Crimping
Iwiss Tools Co.,Ltd15 vistas
SWM L15-L28_drhasan (Part 2).pdfSWM L15-L28_drhasan (Part 2).pdf
SWM L15-L28_drhasan (Part 2).pdf
MahmudHasan74787028 vistas
performance uploading.pptxperformance uploading.pptx
performance uploading.pptx
SanthiS107 vistas
What is Unit TestingWhat is Unit Testing
What is Unit Testing
Sadaaki Emura21 vistas

Stack Queue SubRoutine

  • 1. IPSITA RAHA | 11500120054 DIBYENDU BANIK | 11500320062 ARNAB PAUL | 11500320075 ARNAB CHATTERJEE | 11500320076 ARIJIT DHALI | 11500320078 STACK, QUEUE & SUBROUTINE EC 502 Computer Architecture Group: 5
  • 2. CONTENT 1. STACK OVERVIEW 2. QUEUE OVERVIEW 3. APPLICATION OF STACK AND QUEUE 4. SUBROUTINE OVERVIEW 5. SUBROUTINE APPLICATION WITH EXAMPLE
  • 3. STACK • Stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). • Insertion and deletion takes place at one end. Example : Plates stacked over one another in canteen Top Push Pop
  • 4. QUEUE • A Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). • Insertion takes place at the rear end, and deletion takes place at the front end. Example : Customers standing in a line at canteen Front Rear Enqueue Dequeue
  • 5. QUEUE • Queue is used in solving problems having sequential processing. • Applied as waiting lists for a single shared resource like CPU, Disk, Printer. • Applied as buffers on MP3 players and portable CD players. • Applied on Operating system to handle interruption. • Applied to add song at the end or to play from the front. STACK • Stack is used in solving problems works on recursion. • Evaluation of Arithmetic Expressions • Backtracking • Delimiter Checking • Reverse a Data • Processing Function Calls APPLICATION OF STACK AND QUEUE Stack as well as Queue are used in manipulating the flow of data in a network.
  • 6. SUB ROUTINE The block of instruction which carries out a specific and well defined task is called a subroutine. Moreover, it is a small block of instruction, written and stored separately. Working principle of Sub-Routine 1. Halts the main program. 2. Provide returning to the main point. 3. Transfer control is called subroutine. 4. Executes the subroutine. 5. Revert to the main routine. Program Start Subroutine Call Rest of Program Program End Subroutine Start Subroutine Program Subroutine End Main Program Subroutine Transfer Return
  • 7. SUB ROUTINE • Decomposing a complex programming task into simpler steps. • Reducing duplicate code within a program • Enabling reuse of code across multiple programs • Dividing a large programming task among various programmers or various stages of a project • Hiding implementation details from • Improving readability of code • Improving traceability APPLICATIONS EXAMPLE SUBROUTINE SUB multiply(INT : number) for i runs 1 to 5 (e.g. for(i=1;i<=5;i++)) OUTPUT number * i NEXT END SUB PROGRAM INPUT num CALL multiply(num)
  • 8. CONCLUSION • Stacks : A stack is a basic data structure that can be logically thought as linear structure represented by a real physical stack or pile, a structure where insertion and deletion of items takes place at one end called top of the stack. • Queue : Queue is an abstract data structure, somewhat similar to Stacks. Unlike stacks, a queue is open at both its ends. One end is always used to insert data (enqueue) and the other is used to remove data (dequeue). • Subroutine : Subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed.