DSC-Banasthali-Vidyapith / Code-Crossroad

This project contains the carefully compiled Data Structures & Algorithm questions asked by the companies that visit Banasthali Vidyapith on-campus.
MIT License
55 stars 78 forks source link

Count Strongly Connected Components using Kosaraju Algorithm #153

Closed thepranaygupta closed 2 years ago

thepranaygupta commented 2 years ago

Strongly Connected Components (Kosaraju's Algo)

Problem Statement: Given a Directed Graph with V vertices (Numbered from 0 to V-1) and E edges, Find the number of strongly connected components in the graph.

Example

Input : 5 5
1 0
0 2
2 1
0 3
3 4

Output : 3


Solution: I'd like to provide a well commented C++ code to this problem with the most optimised time and space complexity of O(V+E). I'd like to add the solution in the 'Graphs' topic folder.

Kindly assign this issue to me and add the necessary labels for HacktoberFest.