Find if Path Exists in Graph - Leetcode 1971 - Graphs (Python)

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.พ. 2025
  • Master Data Structures & Algorithms for FREE at AlgoMap.io/
    Code solutions in Python, Java, C++ and JS for this can be found at my GitHub repo here: github.com/gah...
    Complete DSA Pathway Zero to Hero: • Data Structures & Algo...
    Please check my playlists for free DSA problem solutions:
    • Fundamental DSA Theory
    • Array & String Questions
    • 2 Pointers Questions
    • Sliding Window Questions
    • Binary Search Questions
    • Stack Questions
    • Linked List Questions
    • Tree Questions
    • Heap Questions
    • Recursive Backtracking...
    • Graph Questions
    • Dynamic Programming (D...
    My Data Science & ML TH-cam Playlist: • Greg's Path to Become ...
    Learn Python and Data Science FASTER at mlnow.ai :)
    Support the content: / @greghogg
    Follow me on Instagram: / greghogg5
    Connect with me on LinkedIn: / greghogg
    Follow me on TikTok: / greghogg5
    Coursera Plus: imp.i384100.ne...
    My Favorite Courses:
    Data Structures & Algorithms:
    UCalifornia San Diego DSA: imp.i384100.ne...
    Stanford Algorithms: imp.i384100.ne...
    Python Data Structures: imp.i384100.ne...
    Meta Coding Interview Prep: imp.i384100.ne...
    Python:
    UMichigan Python for Everybody: imp.i384100.ne...
    Python Mastery from MLNOW.ai: mlnow.ai/cours...
    Google IT Automation w/ Python: imp.i384100.ne...
    Web Dev / Full Stack:
    Meta Front-End Developer: imp.i384100.ne...
    IBM Full Stack Developer: imp.i384100.ne...
    Meta Back-End Developer: imp.i384100.ne...
    John Hopkins HTML, CSS & JS: imp.i384100.ne...
    IBM DevOps: imp.i384100.ne...
    Cloud Development:
    AWS Fundamentals: imp.i384100.ne...
    GCP Cloud Engineer: imp.i384100.ne...
    Microsoft Azure Fundamentals: imp.i384100.ne...
    Game Development:
    Michigan State Unity Development: imp.i384100.ne...
    UColorado C++ for Unreal Engine: www.coursera.o...
    SQL & Data Science:
    SQL by MLNOW.ai: mlnow.ai/cours...
    Python for Data Science by MLNOW.ai: mlnow.ai/cours...
    Google Data Analytics: imp.i384100.ne...
    IBM Data Science: imp.i384100.ne...
    IBM Data Engineer: imp.i384100.ne...
    Machine Learning & AI:
    ML Mastery at MLNOW.ai: mlnow.ai/cours...
    ML w/ Andrew Ng: www.coursera.o...
    Deep Learning w/ Andrew Ng: imp.i384100.ne...

ความคิดเห็น • 17

  • @GregHogg
    @GregHogg  6 หลายเดือนก่อน +1

    Master Data Structures & Algorithms For FREE at AlgoMap.io!

  • @omerkhan7664
    @omerkhan7664 หลายเดือนก่อน

    I watched so many leetcode vids, I understand their algorithm but they never explain the implementation. You explain the code/implementation so well that I really understand the algorithm a lot better too. Best leetcode TH-cam out here. Thanks for your help!!

  • @kedarkulkarni9464
    @kedarkulkarni9464 6 หลายเดือนก่อน +9

    I have gone through soooo many videos from youtubers who have done elaborate explanations on DFS, BFS for over 2+ hours but none of them ACTUALLY write proper code to explain how everything works. What is the point of understanding BFS, DFS in theory when you can't write code for it when the time comes. This video is ALL YOU NEED to understand DFS and BFS in graphs.
    Thank you soooo much for finally giving a video that is clean, to-the-point, doesn't overexplain, doesn't explain "types of graphs" etc. while explaining BFS and DFS. There is so much BS in tech-youtube space and your channel is a breath of fresh air. Kudos to you

    • @GregHogg
      @GregHogg  6 หลายเดือนก่อน +1

      Wow, this is amazing! Thanks so much! Thanks, I added the code, and will add timestamps soon.

  • @JoeTan-nq4fq
    @JoeTan-nq4fq 24 วันที่ผ่านมา

    For BFS, we can use a 'for' loop instead of deque since 'for' loop 'pop' the item in the queue from the left. Just change 'while q:' to 'for node in q:'
    For faster search, use Union Find

  • @Axel-tt9di
    @Axel-tt9di 3 หลายเดือนก่อน +1

    Best explanation, clear and concise.

  • @ANUMKHAN-d5v
    @ANUMKHAN-d5v 6 หลายเดือนก่อน +1

    Amazing to-the-point explanation. Thanks @GregHogg!

    • @GregHogg
      @GregHogg  6 หลายเดือนก่อน

      Glad to hear it!

  • @christianjt7018
    @christianjt7018 6 หลายเดือนก่อน

    Excellent explanation, thanks Greg!

    • @GregHogg
      @GregHogg  5 หลายเดือนก่อน

      Glad you liked it :)

  • @Rutik9999
    @Rutik9999 2 หลายเดือนก่อน

    best problem to learn all 3 traversal techniques

  • @shantanukulkarni2413
    @shantanukulkarni2413 8 หลายเดือนก่อน +2

    Hi greg,
    Great that you have been consistently uploading DSA problems. But I wonder what made you switch from posting data science content.

    • @GregHogg
      @GregHogg  8 หลายเดือนก่อน +2

      I just got tired of it tbh. I did it for years and I needed to pivot

    • @shantanukulkarni2413
      @shantanukulkarni2413 8 หลายเดือนก่อน

      @@GregHogg which one to go for in 2024 purely from job market pov.

  • @saurabhbhagat4528
    @saurabhbhagat4528 4 หลายเดือนก่อน

    Isn't the space complexity O(n^2) ? If the graph is fully connected, the number of items to store is n(n-1)

  • @souviksen5177
    @souviksen5177 7 หลายเดือนก่อน +1

    What would be the most efficient way to solve this question?

  • @arsheyajain7055
    @arsheyajain7055 8 หลายเดือนก่อน

    Awesome 🤩