0% found this document useful (0 votes)
42 views9 pages

Lecture-12 Data Structures CSE242

The document defines stacks as an abstract data type that holds ordered items in a linear sequence like a deck of cards. It describes the main stack operations as push, pop, peek, is_empty and is_full. Finally, it lists some applications of stacks like implementing functions, parsing expressions, checking parenthesis matching, converting expressions, and memory management.

Uploaded by

JANGLI GAMERS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views9 pages

Lecture-12 Data Structures CSE242

The document defines stacks as an abstract data type that holds ordered items in a linear sequence like a deck of cards. It describes the main stack operations as push, pop, peek, is_empty and is_full. Finally, it lists some applications of stacks like implementing functions, parsing expressions, checking parenthesis matching, converting expressions, and memory management.

Uploaded by

JANGLI GAMERS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

CSE-242

c t ure Data Structures


Le
14
Contents
• Stacks: Definition
• Primitive operations
• Application of stacks

Department of CSE, School of Engineering and Technology


Lecture - 14 objects whose
behavior is defined by
Stacks: Definition a set of value and a
set of operations
A stack is an abstract data type that holds an ordered, linear sequence of items.
It is named stack as it behaves like a real-world stack, for example – a deck of
cards or a pile of plates, etc.
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). 

Department of CSE, School of Engineering and Technology


Lecture - 14

Stacks: Primitive operations


The main stack operations are:

push(data) adds an element to the top of the stack

pop() removes an element from the top of the stack

peek() returns a copy of the element on the top of the stack without removing it

is_empty() checks whether a stack is empty

is_full() checks whether a stack is at maximum capacity when stored in a static


(fixed-size) structure

Department of CSE, School of Engineering and Technology


Lecture - 14

Stacks: Primitive operations


The main stack operations are:

Department of CSE, School of Engineering and Technology


Lecture - 14

Stacks: Applications
• Stacks are used to implement functions, parsers, expression evaluation, and backtracking
algorithms.

• It is used in all those applications in which data must be stored and retrieved in the last.

• Stacks can be used to check parenthesis matching in an expression.

• Stacks can be used for Conversion from one form of expression to another.

• Stacks can be used for Memory Management. 

Department of CSE, School of Engineering and Technology


Lecture - 14

Stacks: Applications
• Stacks are used to implement functions, parsers,
expression evaluation, and backtracking
algorithms.

• It is used in all those applications in which data


must be stored and retrieved in the last.

• Stacks can be used to check parenthesis


matching in an expression.

• Stacks can be used for Conversion from one


form of expression to another.

• Stacks can be used for Memory Management. 


Department of CSE, School of Engineering and Technology
Lecture - 14

Stacks: Applications
• Stacks are used to implement functions, parsers,
expression evaluation, and backtracking algorithms.

• It is used in all those applications in which data must be


stored and retrieved in the last.

• Stacks can be used to check parenthesis matching in an


expression.

• Stacks can be used for Conversion from one form of


expression to another.

• Stacks can be used for Memory Management. 

Department of CSE, School of Engineering and Technology


Lecture - 14

Stacks: Applications
• Stacks are used to implement functions, parsers, expression evaluation, and backtracking
algorithms.
• It is used in all those applications in which data must be stored and retrieved in the last.
• Stacks can be used to check parenthesis matching in an expression.
• Stacks can be used for Conversion from one form of expression to another.
• Stacks can be used for Memory Management. 

Department of CSE, School of Engineering and Technology


Lecture - 14

Stacks: Applications
• Stacks are used to implement functions, parsers, expression evaluation, and
backtracking algorithms.
• It is used in all those applications in which data must be stored and retrieved
in the last.
• Stacks can be used to check parenthesis matching in an expression.
• Stacks can be used for Conversion from one form of expression to another.
• Stacks can be used for Memory Management. 

Department of CSE, School of Engineering and Technology

You might also like