Skip to content

Commit

Permalink
Create SequentialAlgoFloyd.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyKuz1001 authored Nov 1, 2019
1 parent defeff1 commit 06eaed3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Task02/SequentialAlgoFloyd.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;

namespace Task02
{
public class SequentialAlgoFloyd
{
public static int[,] Execute()
{
int n = GeneralResources.n;
int[,] dist = new int[n, n];
Array.Copy(GeneralResources.graphMatrix, dist, n * n);

for (int k = 0; k < n; k++)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (dist[i, j] > dist[i, k] + dist[k, j])
dist[i, j] = dist[i, k] + dist[k, j];
}
}
}
return dist;
}
}
}

0 comments on commit 06eaed3

Please sign in to comment.