Lecture Notes: Python Programming with Data Structures &
Algorithms
Date: 15 August 2025
1. Introduction to Python & DSA
Python is a versatile, high-level programming language widely used for software development, data
analysis, machine learning, and algorithm implementation. In this course, we combine Python
fundamentals with Data Structures and Algorithms (DSA) concepts, allowing learners to write
efficient, optimized, and scalable code for real-world problems.
2. Purpose and Applications
• To develop problem-solving skills using Python as the implementation language.
• To understand and apply core Data Structures for optimized data storage and manipulation.
• To learn algorithms for searching, sorting, and traversing data efficiently.
• To build practical applications using Python, from console-based utilities to games.
• To prepare for coding interviews and competitive programming.
3. Python Basics
Python syntax is simple and readable, making it an excellent first language for beginners. Key
topics include variables, data types (int, float, str, list, tuple, dict, set), operators, conditional
statements (if-elif-else), loops (for, while), and functions (with and without parameters).
Object-Oriented Programming (OOP) in Python introduces classes, objects, inheritance, and
polymorphism.
4. Core Data Structures & Algorithms
• Arrays and Lists – Storing sequences of data, dynamic resizing, and built-in list methods.
• Stacks – LIFO (Last In, First Out) operations using lists or collections.deque.
• Queues – FIFO (First In, First Out) operations using collections.deque or queue.Queue.
• Linked Lists – Singly, Doubly, and Circular Linked Lists for dynamic memory management.
• Trees – Binary Trees, Binary Search Trees, traversals (Inorder, Preorder, Postorder), height,
and balance checks.
• Graphs – Representations (adjacency list/matrix), BFS, DFS, and cycle detection.
• Hashing – Dictionary and set operations for O(1) average time complexity lookups.
• Sorting Algorithms – Bubble Sort, Merge Sort, Quick Sort, Heap Sort.
• Searching Algorithms – Linear Search, Binary Search.
5. Practical Projects
Two notable projects from this course are: - Snake Game with Leaderboard: A pygame-based
implementation where the player controls a snake to collect food, with real-time score tracking and
a stored leaderboard in JSON format. - Contact Management System (CMS): A menu-driven
console application to add, view, search, update, and delete contacts using Python classes, lists,
dictionaries, and sets to prevent duplicates.
6. Homework Task Instructions
• Implement a Python program to reverse a singly linked list.
• Write a function to perform binary search on a sorted list.
• Develop a class-based Stack implementation with push, pop, and peek operations.
• Implement BFS and DFS traversals for a given graph using adjacency list representation.
• Create a mini project of your choice using at least two DSA concepts (e.g., a TODO app with
priority queue).