Compare commits

..

3 Commits

Author SHA1 Message Date
4bfbea8ca1 Cours BD S2 2025-03-10 08:30:42 +01:00
d1a67ae9a7 Update TP/TP3.md 2025-02-12 16:40:13 +01:00
9a33cbb00f Update TP/TP3.md 2025-02-12 16:02:13 +01:00
3 changed files with 3 additions and 3 deletions

BIN
BDcoursS2p1.pdf Normal file

Binary file not shown.

BIN
BDcoursS2p2.pdf Normal file

Binary file not shown.

View File

@@ -9,17 +9,17 @@ Exercice 1 : Parcours en largeur
----------
Pour cet exercice, vous aurez besoin de file FIFO (First In, First Out).
Vous pouvez par exemple utiliser la classe [`LinkedList`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/LinkedList.html), instanciée pour les entiers avec `LinkedList<Integer>`.
Vous pouvez par exemple utiliser la classe [`LinkedList`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/LinkedList.html), instanciée pour les entiers avec `LinkedList<Integer>`, et chargée avec `import java.util.*;`.
Pour utiliser une LinkedList en tant que file FIFO, vous pouvez utiliser les méthodes :
```
public boolean isEmpty() : Returns true if this collection contains no elements.
Integer remove() : Retrieves and removes the head (first element) of this list.
boolean offer(E e) : Adds the specified element as the tail (last element) of this list.
boolean offer(int i) : Adds the specified element i as the tail (last element) of this list.
```
**Question :**
Ecrire une fonction qui, étant donnés un graphe g et un sommet v de ce graphe, renvoie sous forme de file FIFO l'ensemble des voisins de v dans g :
Ecrire une fonction qui, étant donnés un graphe g et un sommet i de ce graphe, renvoie sous forme de file FIFO l'ensemble des voisins de i dans g :
```
public LinkedList<Integer> getVoisins(int i);
```