

Python Data Structures
Presentation
•
Other
•
University
•
Hard
Alex James
Used 16+ times
FREE Resource
24 Slides • 0 Questions
1
Python Data Structures

2
What is a Data Structure?
Data structure is a way of defining, storing & retrieving of data in a structural & systematic way. A data structure may contain different type of data items.
3
What are linear and non linear data Structures?
Linear: A data structure is said to be linear if its elements form a sequence or a linear list. Examples: Array. Linked List, Stacks and Queues.
Non-Linear: A data structure is said to be non-linear if traversal of nodes is nonlinear in nature. i.e, These are the data structures in which there is no sequential linking of data elements. Any pair or group of data elements can be linked to each other and can be accessed without a strict sequence. Example: Graph and Trees.
4
Linear Data Structures
Array: It is a sequential arrangement of data elements paired with the index of the data element.
Linked List: Each data element contains a link to another element along with the data present in it.
Stack: It is a data structure which follows only to specific order of operation. LIFO(last in First Out) or FILO(First in Last Out).
Queue: It is similar to Stack but the order of operation is only FIFO(First In First Out).
Matrix: It is two dimensional data structure in which the data element is referred by a pair of indices.
5
QUIZ - 1
6
Lab Experiment - 1
7
Quiz - 1
8
Non-Linear Data Structures
Binary Tree: It is a data structure where each data element can be connected to maximum two other data elements and it starts with a root node.
Heap: It is a special case of Tree data structure where the data in the parent node is either strictly greater than/ equal to the child nodes or strictly less than it’s child nodes.
Hash Table: It is a data structure which is made of arrays associated with each other using a hash function. It retrieves values
using keys rather than index from a data element.
Graph: It is an arrangement of vertices and nodes where some of the nodes are connected to each other through link.
9
10
Quiz - 2
11
Lab Experiment - 2
12
Quiz - 2
13
Python Specific Data Structures
These data structures are specific to python language and they give greater flexibility in storing different types of data and faster processing in python environment.
14
List: It is similar to array with the exception that the data elements can be of different data types. You can have both numeric and string data in a python list.
Tuple: Tuples are similar to lists but they are immutable which means the values in a tuple cannot be modified they can only be read.
Dictionary: The dictionary contains Key-value pairs as its data elements.
15
Stack
A stack is a linear data structure that stores items in a Last-In-First-Out (LIFO) or First-In-Last-Out (FILO) manner.
In stack, a new element is added at one end and an element is removed from that end only.
The insert and delete operations are often called push and pop.
16
17
Basic Operations of Stack
empty() – Returns whether the stack is empty.
size() – Returns the size of the stack.
top() – Returns a reference to the top most element of the stack.
push(g) – Adds the element ‘g’ at the top of the stack.
pop() – Deletes the top most element of the stack.
18
Implementation of Stack
Using Array
Using Linked List
19
Implementation of Stack using Array
Python’s built-in data structure array can be used as a stack.
Instead of push(), append() is used to add elements to the top of stack while pop() removes the element in LIFO order.
20
Implementation of Stack using Linked List
A stack can be easily implemented through the linked list. In stack Implementation, a stack contains a top pointer. which is “head” of the stack where pushing and popping items happens at the head of the list. first node have null in link field and second node link have first node address in link field and so on and last node address in “top” pointer.
21
22
Quiz - 3
23
Lab Experiment -3
24
Quiz - 3
Python Data Structures

Show answer
Auto Play
Slide 1 / 24
SLIDE
Similar Resources on Wayground
18 questions
Surat Lamaran Pekerjaan
Presentation
•
12th Grade
20 questions
kurikulum merdeka
Presentation
•
University
19 questions
Economics-International Trade
Presentation
•
12th Grade
18 questions
Chapter 1 Introduction
Presentation
•
University
19 questions
INGLES 1 - Sesión 2 Greetings and Farewells
Presentation
•
University
19 questions
General Interview Question
Presentation
•
University
19 questions
Chapter 20 & 30 Active Learning
Presentation
•
University
19 questions
CC Hemodynamics
Presentation
•
University
Popular Resources on Wayground
15 questions
Grade 3 Simulation Assessment 1
Quiz
•
3rd Grade
22 questions
HCS Grade 4 Simulation Assessment_1 2526sy
Quiz
•
4th Grade
16 questions
Grade 3 Simulation Assessment 2
Quiz
•
3rd Grade
19 questions
HCS Grade 5 Simulation Assessment_1 2526sy
Quiz
•
5th Grade
17 questions
HCS Grade 4 Simulation Assessment_2 2526sy
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
24 questions
HCS Grade 5 Simulation Assessment_2 2526sy
Quiz
•
5th Grade
20 questions
Math Review
Quiz
•
3rd Grade
Discover more resources for Other
36 questions
8th Grade US History STAAR Review
Quiz
•
KG - University
25 questions
Spanish future tense
Quiz
•
10th Grade - University
55 questions
Post Malone Addtion (Tres)
Quiz
•
12th Grade - University
15 questions
Quotation Marks vs. Italics for MLA
Quiz
•
9th Grade - University
20 questions
Disney Trivia
Quiz
•
University
50 questions
AP Biology Exam Review 2017
Quiz
•
11th Grade - University
215 questions
8th Physical Science GA Milestones Review
Quiz
•
KG - University
20 questions
Ch15_review_TEACHER
Quiz
•
University