AlgoDS-Examen2024/README.md
LordBaryhobal ddb1073b63
All checks were successful
Python unit tests / unittests (push) Successful in 5s
fixed typo
2025-01-24 16:31:14 +01:00

151 lines
3.0 KiB
Markdown

# Examen 2024
---
_**201.1 Algorithmes et Structures de données**_
![unit tests workflow](https://git.kb28.ch/HEL/AlgoDS-Examen2024/actions/workflows/tests.yaml/badge.svg)
Voici mes réponses pour l'examen 2024 d'_Algorithmes et Structures de données_ ainsi que les tests unitaires fournis.
## Exercice 1
<table>
<tr>
<td><strong>But</strong></td>
<td>Compter le nombre de triangles dans un graphe</td>
</tr>
<tr>
<td><strong>Input</strong></td>
<td>Liste des arêtes du graphe</td>
</tr>
<tr>
<td><strong>Output</strong></td>
<td>Nombre de triangles</td>
</tr>
<tr>
<td><strong>Signature</strong></td>
<td>
```python
def countTriangles(
edges: list[tuple[int, int]]
) -> int:
```
</td>
</tr>
</table>
[Source](https://git.kb28.ch/HEL/AlgoDS-Examen2024/src/branch/main/src/ex1_triangles.py)
/
[Tests](https://git.kb28.ch/HEL/AlgoDS-Examen2024/src/branch/main/tests/test_ex1.py)
## Exercice 2
<table>
<tr>
<td><strong>But</strong></td>
<td>Calculer le plus grand nombre d'émissions complètes consécutives qui peuvent être enregistrées sur un disque de taille finie</td>
</tr>
<tr>
<td><strong>Input</strong></td>
<td>Liste des durées des émissions, durée totale d'enregistrement maximum</td>
</tr>
<tr>
<td><strong>Output</strong></td>
<td>Nombre maximum d'émissions consécutives complètes enregistrables</td>
</tr>
<tr>
<td><strong>Signature</strong></td>
<td>
```python
def startRecordingAt(
tv_show: list[int],
hard_drive_memory: int
) -> int:
```
</td>
</tr>
</table>
[Source](https://git.kb28.ch/HEL/AlgoDS-Examen2024/src/branch/main/src/ex2_tv.py)
/
[Tests](https://git.kb28.ch/HEL/AlgoDS-Examen2024/src/branch/main/tests/test_ex2.py)
## Exercice 3
<table>
<tr>
<td><strong>But</strong></td>
<td>Calculer le score maximum en prenant tour à tour un des côtés d'une série de cartes</td>
</tr>
<tr>
<td><strong>Input</strong></td>
<td>Liste des cartes (valeurs)</td>
</tr>
<tr>
<td><strong>Output</strong></td>
<td>Score maximum face à un adversaire optimal</td>
</tr>
<tr>
<td><strong>Signature</strong></td>
<td>
```python
def tauntScore(
cards: list[int]
) -> int:
```
</td>
</tr>
</table>
[Source](https://git.kb28.ch/HEL/AlgoDS-Examen2024/src/branch/main/src/ex3_cards.py)
/
[Tests](https://git.kb28.ch/HEL/AlgoDS-Examen2024/src/branch/main/tests/test_ex3.py)
## Exercice 4
<table>
<tr>
<td><strong>But</strong></td>
<td>Trouver la meilleure manière de déplacer des meubles d'un agencement donné à un autre</td>
</tr>
<tr>
<td><strong>Input</strong></td>
<td>
Agencement actuel, agencement final\
(grille de valeurs, 0=vide, `i`=meuble n°`i`)
</td>
</tr>
<tr>
<td><strong>Output</strong></td>
<td>Liste des états intermédiaires</td>
</tr>
<tr>
<td><strong>Signature</strong></td>
<td>
```python
def minimumMoves(
current_plan: list[list[int]],
target_plan: list[list[int]]
) -> list[list[list[int]]]:
```
</td>
</tr>
</table>
[Source](https://git.kb28.ch/HEL/AlgoDS-Examen2024/src/branch/main/src/ex4_furniture.py)
/
[Tests](https://git.kb28.ch/HEL/AlgoDS-Examen2024/src/branch/main/tests/test_ex4.py)