Professional Documents
Culture Documents
IN
PYTHON
PREPARED BY :
JYOTI GUPTA
PGT(COMPUTER SCIENCE)
KV SLIET LONGOWAL
As per latest CBSE syllabus 2020-21, the topics
to be covered in Data-structures for class XII
are:
• Lists as covered in Class XI
• Stacks – Push, Pop using a list
• Queues – Insert, Delete using a list.
PREREQUISITES
The students should already know
(A Review)
LIST IS :
Listnum=[3,6,8,4,9,2,8]
3 6 8 4 9 2 8
index 0 1 2 3 4 5 6
Negative
index -7 -6 -5 -4 -3 -2 -1
Now , we will perform following operations on given list using in
built functions of Python :
Listnum=[3,6,8,4,9,2,8]
STACK EXAMPLES
stack of books or stack of plates
STACK OPERATIONS
There are basically two operations on Stack:
(a) PUSH (b) POP
PUSH OPERATION
inserting an element in the stack
POP OPERATION
deleting an element from the stack
WHAT IS TOP ?
• It is the index of top most element of the stack.
Or
• the recent element pushed in the Stack.
Implementation
Of Stacks
In PYTHON
Implementation
Stacks can be implemented using lists in Python.
JYOTI GUPTA
PGT(COMPUTER SCIENCE)
KV SLIET LONGOWAL