Code repository for my YouTube DSA tutorial series π₯
Welcome! This repository contains all the code examples and implementations from my Data Structures and Algorithms tutorial videos. Whether you're preparing for technical interviews, solving LeetCode problems, or just want to understand how data structures work in Python, you've come to the right place!
β If you find this helpful, please star this repo and subscribe to my channel! β
- Complete code examples from each video
- Step-by-step implementations with clear explanations
- Common patterns and techniques used in LeetCode problems
- Beginner-friendly explanations that make complex concepts easy to understand
π€ "I don't understand the ListNode class" - 219+ people on LeetCode
If linked lists feel confusing, you're not alone! This is THE foundational video you need before tackling any LeetCode linked list problems.
- β What a ListNode actually IS (using the treasure hunt analogy that finally makes it click)
- β
Why we use
.valand.nextinstead of regular Python lists - β How to create and connect nodes step-by-step
- β How to traverse a linked list without getting lost
- β Common beginner mistakes (and how to avoid the dreaded "NoneType has no attribute" error)
- β Get confused when you see ListNode in LeetCode problems
- β Don't understand why we can't just use regular Python lists
- β Keep getting NoneType errors when working with linked lists
- β Want to prepare for technical interviews
By the end of this video, you'll understand linked lists well enough to tackle problems like "Merge Two Sorted Lists," "Reverse Linked List," and more!
π This is Part 1 of my Linked List series - we build the foundation here, then solve real LeetCode problems in the next videos.
The notebook contains practical examples demonstrating:
-
Basic ListNode Class Definition
- The fundamental structure with
valandnextattributes
- The fundamental structure with
-
Creating and Connecting Nodes
- Example 1: Creating individual nodes (kitchen, bedroom, garage)
- Example 2: Connecting two nodes (
firstβsecond) - Example 3: Building a chain of three nodes (
node1βnode2βnode3)
-
Accessing Node Values
- How to access
valattribute - Understanding
Nonewhennextis not set
- How to access
-
Traversing a Linked List
- Using a
currentpointer to move through the list - Understanding when you've reached the end (when
currentbecomesNone)
- Using a
- Node Creation:
ListNode(val)creates a new node with a value - Linking Nodes:
node1.next = node2connects nodes together - Traversal Pattern: Using
current = current.nextto move through the list - None Handling: Understanding when
nextisNone(end of list)
- 0:00 - Why linked lists confuse everyone
- 1:30 - The treasure hunt analogy (this will make it click!)
- 4:00 - Building your first ListNode in Python
- 7:00 - Connecting multiple nodes together
- 10:00 - Traversing a linked list (the right way)
- 13:00 - Common errors and how to debug them
- 15:30 - When to use linked lists vs regular lists
-
Clone this repository:
git clone https://github.com/yourusername/data_structures_python.git cd data_structures_python -
Open the notebooks:
- Use Jupyter Notebook, JupyterLab, or VS Code with Jupyter extension
- Each notebook corresponds to a video in the series
-
Follow along:
- Watch the corresponding video
- Run the code examples
- Experiment and modify the code to deepen your understanding
- Part 1: Understanding ListNode (this video) β
- Part 2: Merge Two Sorted Lists (coming soon)
- Part 3: Reverse Linked List (coming soon)
- More videos coming...
Found a bug or have a suggestion? Feel free to open an issue or submit a pull request!
If you find these tutorials helpful:
- β Star this repository to help others find it
- π Subscribe to my YouTube channel for more DSA content
- π¬ Share with friends who are also learning DSA
#linkedlist #python #leetcode #programming #datastructures #coding #algorithms #tutorial #beginnerfriendly #tech
This repository is for educational purposes. Feel free to use the code for learning and practice!
Happy Coding! π
Remember: Understanding data structures is a journey. Take your time, practice, and don't hesitate to rewatch videos or experiment with the code!