Se ha denunciado esta presentación.
Se está descargando tu SlideShare. ×

Revised Data Structure- STACK in Python XII CS.pdf

Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Próximo SlideShare
TSAT Presentation1.pptx
TSAT Presentation1.pptx
Cargando en…3
×

Eche un vistazo a continuación

1 de 15 Anuncio

Más Contenido Relacionado

Similares a Revised Data Structure- STACK in Python XII CS.pdf (20)

Más reciente (20)

Anuncio

Revised Data Structure- STACK in Python XII CS.pdf

  1. 1. Know Python Bytes w w w . k n o w p y t h o n b y t e s . b l o g s p o t . c o m Mrs. Payal Bhattacharjee, PGT(C.Sc.) K V No.1 Kanchrapara KVS-RO(Kolkata) S T A C K
  2. 2. UNIT-1 (Revised syllabus) XII CS COMPUTATIONAL THINKING AND PROGRAMMING-II Chapter: Data Structure: STACK C O N T E N T S ( L EA R N I N G O U TCO M ES ) 2 0 2 2 - 2 3 Data-structures: ➢ Lists as covered in Class XI, ➢ Stacks – Push, Pop using a list.
  3. 3. What is a Data Structure? • Data Structures are a way of organizing, accessing and storing data more efficiently in a program depending upon the situation. Data Structures are fundamentals of any programming language around which a program is built. Why Data structures in Python is easy? • Python helps to learn the fundamental of these data structures in a simpler way as compared to other programming languages.
  4. 4. OPERATIONS ON DATA STRUCTURES CREATION : Creating/Defining a data structure as per requirement INSERTION : Adding/Inserting a new element or data DELETION : Delete/Remove an existing element or data SEARCHING : Search for the specified element or data TRAVERSAL : Access / Process all the elements or data SORTING : Arrange/Organize elements in ascending/descending order MERGING : Merge/Combine elements of two or more data structures of the same type.
  5. 5. DATA STRUCTURES IN PYTHON BUILT-IN DATA STRUCTURES LIST TUPLE SETS DICTIONARY USER-DEFINED DATA STRUCTURES STACK QUEUE TREE HASHMAP LINKED LIST GRAPH
  6. 6. DATA STRUCTURE : STACK STACK: Stack is a linear data structure in which the elements can be added or removed only from one end known as “Top” of the stack. The discipline of Stack is LIFO (Last In First Out) i.e. element inserted last will be removed first. Or, we can say First In Last Out. Whereas in a LIST, we can add or delete any element from any position. REAL LIFE APPLICATION OF STACK The stack of trays in a cafeteria or plates in a cupboard Stack of Books or copies Stack of coins Stack of Bags / Clothes / Chairs Some Applications of a stack are: 1.Converting infix to postfix expressions. 2.Undo/Redo button/operation in word processors. 3.Syntaxes in languages are parsed using stacks. 4.It is used in many virtual machines like JVM (Java Virtual Machine). 5.History of visited websites. 6.Message logs and all messages you get are arranged in a stack. 7.Call logs, E-mails, Google photos’ any gallery, YouTube downloads, Notifications ( latest appears first ). 8.Scratch card’s earned after Google pay transaction. 9.Wearing/Removing Bangles, Pile of Dinner Plates, Stacked chairs. 10.Recursion. 11.Used in IDEs to check for proper parentheses matching 12.Media playlist. T o play previous and next song
  7. 7. Operation on Stack: The basic operations on stack is defined as: ❑ Push- addition of new element on the top of stack. We are going to implement List as a Stack, so, to add element , we have to use append( ) method of List. ❑ Pop – deletion of element from the top. We are going to implement List as a Stack, so, to remove the top element , we have to use pop( ) method of List. ❑ isEmpty - indicates whether any elements are stored in the stack or not (underflow). Empty STACK 10 45 10 32 45 10 27 32 45 10 27 32 45 10 32 45 10 PUSH 10 PUSH 45 PUSH 32 PUSH 27 PUSH 15 POP STACK OVERFLOW 10 45 32 27 27 45 10 POP 32 STACK UNDERFLOW Empty Stack 10 POP 45 POP 10 POP
  8. 8. OUTPUT
  9. 9. QUESTION FROM QBANK (THEORY)
  10. 10. Bibliograhy and References • Google • Wikipedia • Quora • geeksforgeeks • Book: XII Computer Science • By Sumita Arora, Dhanpat Rai Publication 2020 Edition
  11. 11. Stay safe. Stay aware. Stay healthy. Stay alert.

×