forked from menault/TD4_DEV51_Qualite_Algo
complexité
This commit is contained in:
@@ -2,6 +2,7 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Algorithme {
|
||||
// O(n²m+nm²)
|
||||
public static void Algo(int[][] a) {
|
||||
if (a == null) throw new IllegalArgumentException("Tableau null");
|
||||
int n = a.length;
|
||||
@@ -26,6 +27,7 @@ public class Algorithme {
|
||||
for (int i = 0; i < n; i++) selection(a[i]);
|
||||
}
|
||||
|
||||
// O(n²)
|
||||
public static void selection(int[] arr) {
|
||||
int n = arr.length;
|
||||
for (int i = 0; i < n - 1; i++) {
|
||||
@@ -39,12 +41,14 @@ public class Algorithme {
|
||||
}
|
||||
}
|
||||
|
||||
// O(n)
|
||||
public static int sum(int[] arr) {
|
||||
int s = 0;
|
||||
for (int x : arr) s += x;
|
||||
return s;
|
||||
}
|
||||
|
||||
// O(n²m+nm²)
|
||||
public static void main(String[] args) {
|
||||
int[][] t = {
|
||||
{0, 3, 2},
|
||||
|
Reference in New Issue
Block a user