0% found this document useful (0 votes)
11 views

Stack Using List

Uploaded by

sharmarohan424
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Stack Using List

Uploaded by

sharmarohan424
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

CLASS XII

(COMPUTER SCIENCE: 083)

STACK USING LIST


Data Structure
 Data Structure is a way of collecting and organizing data in such a
way that we can perform operations on these data in an effective
way.
 Types of Data Structures in Python:
Data
Structures in
Python

Built-in-Data User-Defined Data


Structures Structures

List Tuple Dictionary Set Stack Queue Tree Linked List


Stack
 Stack is a data structure in which insertion and deletion of elements can be
done, only at the one end that is called top.
 Stack follows Last-In-First-Out(LIFO) principle i.e., the element which is
inserted last in the stack, will be deleted first from the stack.
 Examples of stack:

Stack of Pizzas
Stack of Books Stack of Coins
Stack Operations
Push()- Inserting element at the top of stack.
Open end
Push 10 Push 20 Push 30 Push 40 Push 50

50 T
40 40
T
30 T 30 30
20 20 20 20
T
10 T 10 10 10 10
Empty Stack

Pop()- deleting element from the top of stack. Here T stands for Top

T 50 Pop 50 Pop 40 Pop 20


Pop 30 Pop 10 Pop
40 T 40 “Stack-
30 30 underflow”
T 30
20 20 20 T 20
10 10 10 10 T 10

You might also like