Thoughts, notes, and explanations on Python, Data Structures, Algorithms, Machine Learning, and learning how to learn effectively.
This section will grow over time with structured posts and practical insights.
Thoughts, notes, and explanations on Python, Data Structures, Algorithms, Machine Learning, and learning how to learn effectively.
This section will grow over time with structured posts and practical insights.

UML Deep Dive: Class Diagrams and Sequence Diagrams Who this is for: Anyone who has been designing classes and systems (perhaps through OOP, SOLID, and design patterns) and now wants a standardized visual language to communicate those designs to teammates, interviewers, and their own future self. Table of Contents Why UML Exists The 14 UML Diagram Types: A Complete Map Class Diagrams: Anatomy of a Class Box Abstract Classes vs. Interfaces: Are They the Same Thing? Class Diagrams: Relationships Between Classes Class Diagrams: Advanced Concepts Sequence Diagrams: Why We Need a Second Diagram Sequence Diagrams: Anatomy and Core Concepts Sequence Diagrams: Control Flow (alt, opt, loop, par) 9.5 More Sequence Diagram Examples Putting It All Together: A Simple E-Commerce System 10.1 The Complete Class Diagram 10.2 The Complete Sequence Diagram Summary and Key Takeaways Practice Questions with Solutions 1. Why UML Exists When a design exists only in someone’s head, or scattered across a codebase, it is expensive to communicate. Explaining a system in prose forces the listener to reconstruct a graph of classes and relationships from a linear sequence of sentences, and details get lost or misinterpreted along the way. Two people reading the same paragraph of design prose regularly walk away with two different mental models of the same system, particularly around exactly how strong a relationship between two entities is. ...

🗺️ Array Patterns - The Complete Study Guide Welcome This is a structured, beginner-friendly study guide for mastering array and string patterns - the building blocks of coding interviews. Each pattern has a dedicated deep-dive document with theory, intuition, templates, and 10 LeetCode problems solved step by step. Who is this for? You’re preparing for coding interviews and want a systematic approach You can solve easy problems but struggle to recognize which technique to apply You want to understand why an approach works, not just memorize solutions How to use this guide: ...

Arrays Table of Contents What You Will Learn in This Blog How Data is Stored in Computer Memory What is an Array Arrays in Python Python Lists The array Module NumPy Arrays Comparison of the Three Referential Arrays vs Value Arrays Dynamic Arrays – How Python Lists Grow Time and Space Complexity of Array Operations Two-Dimensional Arrays Patterns and Techniques Pattern 1 – Two Pointers Pattern 2 – Sliding Window Pattern 3 – Prefix Sum Summary Key Takeaways Practice Problems Next Steps What You Will Learn in This Blog How data is stored in computer memory and why it matters What an array is and how it uses contiguous memory How Python represents arrays – lists, the array module, and NumPy The difference between referential arrays and value arrays How dynamic arrays work and how Python lists resize themselves Time and space complexity of every common array operation Three core patterns that come from arrays: Two Pointers, Sliding Window, and Prefix Sum Solved LeetCode problems for each pattern A practice problem table for further study How Data is Stored in Computer Memory Before we talk about arrays, we need to understand the environment arrays live in – computer memory. ...

🔰 Pattern 2: Binary Search Table of Contents What is Binary Search? The Core Idea - Why Halving Works The Three Binary Search Templates Binary Search on Answer - The Hidden Pattern Common Pitfalls Problem Set Problem 1: Binary Search Problem 2: Search Insert Position Problem 3: Find First and Last Position of Element in Sorted Array Problem 4: Search a 2D Matrix Problem 5: Search in Rotated Sorted Array Problem 6: Find Minimum in Rotated Sorted Array Problem 7: Koko Eating Bananas Problem 8: Capacity to Ship Packages Within D Days Problem 9: Split Array Largest Sum Problem 10: Median of Two Sorted Arrays Key Takeaways & Summary What is Binary Search? In the Two Pointers pattern, we used two indices to narrow down a search space. Binary search takes that idea to its most powerful form: instead of narrowing one step at a time, we cut the search space in half at every step. ...

Complexity Analysis – Time and Space Table of Contents What You Will Learn in This Blog Why Do We Need Complexity Analysis Building Intuition First How We Evaluate Algorithms – A Brief History Approach 1 – Experimental Analysis Approach 2 – Counting Every Operation Exactly Approach 3 – Asymptotic Analysis Primitive Operations – The Foundation of the Model What is Big O Notation The Common Complexity Classes O(1) – Constant Time O(log n) – Logarithmic Time O(n) – Linear Time O(n log n) – Linearithmic Time O(n^2) – Quadratic Time O(2^n) – Exponential Time O(n!) – Factorial Time Comparing the Complexity Classes How to Analyse Code Step by Step Space Complexity Common Misconceptions Complexity of Python Built-ins Practice Problems Summary Key Takeaways Next Steps What You Will Learn in This Blog Why complexity analysis exists and what problem it solves How to think about the efficiency of code intuitively before using any formula What Big O notation is and what it actually means The most common complexity classes with examples and code for each How to analyse any piece of code step by step Space complexity and how to think about memory usage Common misconceptions that trip up beginners Practice problems to test your understanding Why Do We Need Complexity Analysis Before anything else, let us answer the most important question: why does this topic exist at all? ...
Control Flow in Python Making Decisions in Your Code – if, elif, else, and Beyond Before We Begin – Why Control Flow is Everything Every program you have ever used makes decisions. When you log into a website: if the password is correct, show the dashboard, otherwise show an error. When your food delivery app calculates the delivery fee: if the order is above Rs.200, delivery is free, else charge Rs.30. When a data pipeline processes records: if the record is valid, process it, else log an error and skip it. ...

🔰 Pattern 4: HashMap / Frequency Counting Table of Contents What is the HashMap Pattern? When to Use HashMaps? Types of HashMap Patterns Template Code Problem Set Problem 1: Two Sum Problem 2: Valid Anagram Problem 3: Group Anagrams Problem 4: Top K Frequent Elements Problem 5: Longest Consecutive Sequence Problem 6: Contains Duplicate II Problem 7: Intersection of Two Arrays II Problem 8: First Unique Character in a String Problem 9: 4Sum II Problem 10: Encode and Decode TinyURL Key Takeaways & Summary What is the HashMap Pattern? In the previous patterns, we’ve already used hashmaps as a supporting tool - tracking character frequencies in sliding window, storing prefix sums for subarray problems. In this section, we focus on problems where the hashmap is the core of the solution, not just a helper. ...

Linked Lists Table of Contents What You Will Learn in This Blog Why Linked Lists Exist What is a Node What is a Linked List Singly Linked List Building the Node Class Building the LinkedList Class Append – Insert at Tail Prepend – Insert at Head Insert at Position Delete by Value Delete at Position Search Traverse and Print Length of the List Reverse a Linked List Singly Linked List – Complete Implementation Time and Space Complexity Summary Doubly Linked List Building the DoublyNode Class Building the DoublyLinkedList Class Append and Prepend Insert at Position Delete by Value Traverse Forward and Backward Doubly Linked List – Complete Implementation Time and Space Complexity Summary Circular Linked List What Makes it Circular Building the CircularLinkedList Class Append and Prepend Delete by Value Traverse Circular Linked List – Complete Implementation Time and Space Complexity Summary Arrays vs Linked Lists – When to Use Which Python and Linked Lists Patterns and Techniques Pattern 1 – Fast and Slow Pointers Pattern 2 – In-place Reversal Summary Key Takeaways Practice Problems Next Steps What You Will Learn in This Blog Why linked lists exist and what problem they solve compared to arrays What a node and a pointer are How to build a Singly Linked List from scratch with all operations How to build a Doubly Linked List from scratch with all operations How to build a Circular Linked List from scratch with all operations Time and space complexity of every operation Two patterns: Fast and Slow Pointers, and In-place Reversal Solved LeetCode problems with full explanation A practice problem table for further study Why Linked Lists Exist In the Arrays blog, we learned that arrays store elements in contiguous memory – one right after the other. This gives us O(1) access by index, which is powerful. But contiguous memory comes with a cost: ...
Logging and System Interaction in Python Professional Observability with the logging Module and the os Module Before We Begin – Why This Matters More Than It Looks Here is a situation every developer eventually faces. You write a script that processes data overnight. It runs on a server while you sleep. In the morning you check the output and something is wrong. Half the records are missing. You have no idea what happened because your script used print() for all its messages and those prints went nowhere – there was nobody watching the terminal. ...