Skip to content

Commit 62ab42a

Browse files
committed
-
1 parent 8e9b1e9 commit 62ab42a

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

_posts/2024/2024-10-08-algorithm-exercises-1.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ Given an unweighted, undirected, and connected graph $G = (V, E)$. Construct an
7171

7272
Solution:
7373

74-
Run BFS from each node as the source. Update the max distance that BFS reached in each run. Return the max distance as the diameter of the graph. The time complexity is $O(|V|*(|V|+|E|))$.
75-
76-
Pseudocode:
74+
Run BFS from each node as the source. Update the max distance that BFS reached in each run. Return the max distance as the diameter of the graph. The time complexity is $O(\lvert V \rvert*(\lvert V \rvert + \lvert E \rvert))$. Pseudocode:
7775

7876
```csharp
7977
int findDiameter(G):

0 commit comments

Comments
 (0)