forked from menault/TD4_DEV51_Qualite_Algo
Exo 3 à finir
This commit is contained in:
16
Exercice2.md
Normal file
16
Exercice2.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
**Calculs de complecité de fonctions**
|
||||||
|
|
||||||
|
- Function_1
|
||||||
|
- Complexité = 1
|
||||||
|
- O(n×m)
|
||||||
|
|
||||||
|
|
||||||
|
- Function_2
|
||||||
|
- Complexité = 1
|
||||||
|
- O(n)
|
||||||
|
|
||||||
|
- Function_3
|
||||||
|
- Complexité = 1
|
||||||
|
- O(n)
|
||||||
|
|
||||||
|
|
0
Exercice3.md
Normal file
0
Exercice3.md
Normal file
29
fonctions.py
Normal file
29
fonctions.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
def function(tableau1, tableau2):
|
||||||
|
presentDansDeuxListes = 0
|
||||||
|
for nombre1 in tableau1:
|
||||||
|
for (nombre2 in tableau2):
|
||||||
|
if (nombre1 == nombre2):
|
||||||
|
presentDansDeuxListes += 1
|
||||||
|
break
|
||||||
|
return presentDansDeuxListes
|
||||||
|
|
||||||
|
|
||||||
|
def funtion_2(x):
|
||||||
|
valeur = 0
|
||||||
|
while (x > 0):
|
||||||
|
valeur = valeur + x
|
||||||
|
x -= 1
|
||||||
|
return valeur
|
||||||
|
|
||||||
|
|
||||||
|
def function_3(x):
|
||||||
|
valeur = 0
|
||||||
|
|
||||||
|
if (x < 0):
|
||||||
|
valeur = -x
|
||||||
|
if (x == 0):
|
||||||
|
pass
|
||||||
|
if (x > 0):
|
||||||
|
valeur = x
|
||||||
|
return valeur
|
||||||
|
|
Reference in New Issue
Block a user