This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| References: | |
| https://www.youtube.com/watch?v=JZBQLXgSGfs | |
| https://www.youtube.com/watch?v=kaBX2s3pYO4 | |
| """ | |
| class Solution: | |
| # The purpose of find with path compression is to reduce the | |
| # no. of hopes needed to determine the parent node. This reduction | |
| # will help to decrease overall runtime from O(n) to O(log n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Targan Alog: https://www.youtube.com/watch?v=ZeDNSeilf-Y | |
| # Find Bridges: https://www.youtube.com/watch?v=Rhxs4k6DyMM&t=0s | |
| # Reference: https://gist.github.com/SuryaPratapK/2774cb957a27448b485609418e272f2b | |
| # Find Bridges using Targan Algo | |
| from typing import List, Set, Dict | |
| class Solution(): | |
| def __init__(self) -> None: | |
| self.timer = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Reference : https://www.youtube.com/watch?v=ZeDNSeilf-Y | |
| from typing import List | |
| class Solution(): | |
| def __init__(self) -> None: | |
| self.timer = 0 | |
| self.discovery = [] | |
| self.low = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Find Strongly Connected Components in a Graph using Kosaraju Algo | |
| # Reference : https://www.youtube.com/watch?v=Rs6DXyWpWrI | |
| from typing import List, Set | |
| class Solution(): | |
| def reverseEdges(self, edges: List[List[int]]) -> List: | |
| edges_rev = [list() for _ in range(len(edges))] |
NewerOlder