Skip to content

wvlt/data_structures_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Data Structures & Algorithms in Python

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! ⭐


🎯 What You'll Find Here

  • 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

πŸ“– Video 1: Linked Lists in Python - Understanding ListNode

πŸ€” "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 You'll Learn:

  • βœ… What a ListNode actually IS (using the treasure hunt analogy that finally makes it click)
  • βœ… Why we use .val and .next instead 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)

πŸ’‘ Perfect if you:

  • ❌ 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.

πŸ“ Code Examples in 1_listnode.ipynb

The notebook contains practical examples demonstrating:

  1. Basic ListNode Class Definition

    • The fundamental structure with val and next attributes
  2. 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)
  3. Accessing Node Values

    • How to access val attribute
    • Understanding None when next is not set
  4. Traversing a Linked List

    • Using a current pointer to move through the list
    • Understanding when you've reached the end (when current becomes None)

πŸ”‘ Key Concepts Covered:

  • Node Creation: ListNode(val) creates a new node with a value
  • Linking Nodes: node1.next = node2 connects nodes together
  • Traversal Pattern: Using current = current.next to move through the list
  • None Handling: Understanding when next is None (end of list)

⏱️ Video Timestamps:

  • 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

πŸš€ Getting Started

  1. Clone this repository:

    git clone https://github.com/yourusername/data_structures_python.git
    cd data_structures_python
  2. Open the notebooks:

    • Use Jupyter Notebook, JupyterLab, or VS Code with Jupyter extension
    • Each notebook corresponds to a video in the series
  3. Follow along:

    • Watch the corresponding video
    • Run the code examples
    • Experiment and modify the code to deepen your understanding

πŸ“š Series Structure

  • Part 1: Understanding ListNode (this video) βœ…
  • Part 2: Merge Two Sorted Lists (coming soon)
  • Part 3: Reverse Linked List (coming soon)
  • More videos coming...

🀝 Contributing

Found a bug or have a suggestion? Feel free to open an issue or submit a pull request!


⭐ Support

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

πŸ“Œ Tags

#linkedlist #python #leetcode #programming #datastructures #coding #algorithms #tutorial #beginnerfriendly #tech


πŸ“ License

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!

About

The code for YouTube videos for Data Structures and Algorithms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published