

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
21 questions
Cold War Intro
Presentation
•
KG
17 questions
Comparatives and superlatives
Presentation
•
University
17 questions
saving and investing
Presentation
•
University
20 questions
MTAP.M12 Identify Muscle Anatomy (Review Session Practice)
Presentation
•
University
19 questions
RWS 1301 Information Timeline
Presentation
•
University
19 questions
Introducción neuroanatomía
Presentation
•
University
20 questions
Past Perfect & Past Continuous
Presentation
•
University
18 questions
Cervelle d'ado (A25)
Presentation
•
University
Popular Resources on Wayground
6 questions
Secondary Safety Quiz
Presentation
•
9th - 12th Grade
10 questions
MyPath Diagnostic Overview
Presentation
•
6th - 8th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Adding and Subtracting Decimals
Quiz
•
5th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
21 questions
Lab Safety
Quiz
•
10th Grade
Discover more resources for Other
20 questions
Disney Trivia
Quiz
•
University
20 questions
Brand Trivia
Quiz
•
9th Grade - University
10 questions
Would you rather...
Quiz
•
KG - University
21 questions
Mapa países hispanohablantes
Quiz
•
1st Grade - University
10 questions
Spanish Greetings and Goodbyes!
Presentation
•
6th Grade - University
12 questions
CE 2b Early Documents Review
Quiz
•
7th Grade - University
30 questions
Multiplying and Dividing Integers
Quiz
•
6th Grade - University
13 questions
Back to School
Quiz
•
KG - University