NUMBER OF CONNECTED COMPONENTS IN AN UNDIRECTED GRAPH | LEETCODE # 323 | PYTHON GRAPH SOLUTION

Поділитися
Вставка
  • Опубліковано 2 гру 2024

КОМЕНТАРІ •

  • @软件实验室
    @软件实验室 5 місяців тому +1

    Very clear explanation, thank you so much! I only knew how to use union find to solve this problem instead of dfs, now i know both!

  • @channel-so2st
    @channel-so2st 2 роки тому +1

    Glad I found your channel. You explain things clearly and articulate well.

    • @crackfaang
      @crackfaang  2 роки тому

      Thank you! Welcome to the channel

  • @hyderabadperlmongers3654
    @hyderabadperlmongers3654 Рік тому

    Excellent, Implementation is original and clean. thanks

  • @souravchakraborty700
    @souravchakraborty700 2 роки тому +1

    Nice Explanation. Thanks a lot

    • @crackfaang
      @crackfaang  2 роки тому

      No problem, glad you found it useful! Make sure to subscribe so you don't miss future videos!

  • @zungulutrungu6407
    @zungulutrungu6407 2 роки тому +2

    keep uploading king, thanks!!!! subbed. i hope i make it, thank you for your uploads

    • @crackfaang
      @crackfaang  2 роки тому +1

      Thank you for the support and your kind words! Any videos you’d like to see in particular?

  • @ramizrizwan3057
    @ramizrizwan3057 Рік тому

    this channel is so goood

  • @asdfgsf9660
    @asdfgsf9660 2 роки тому

    I don't understand why in line 8 you take node from 0 to n-1. The nodes can start from any value right? Not just 0. Why not just input edges[i][0] and edges[i][1] instead?

  • @kapilrules
    @kapilrules Місяць тому

    thank you bro

  • @tugrulerturk8270
    @tugrulerturk8270 2 роки тому

    Thanks for the video! Is the union find algorithm better than dfs for this question?

    • @crackfaang
      @crackfaang  2 роки тому

      Don’t think it matters. Either way it’s going to be a O(N) runtime. It’s whatever you prefer to code and more comfortable with that you should write.
      I prefer standard DFS and am more comfortable with it so I went with this solution.