Compare commits
3 Commits
7163ad13c5
...
master
Author | SHA1 | Date | |
---|---|---|---|
4bfbea8ca1 | |||
d1a67ae9a7 | |||
9a33cbb00f |
BIN
BDcoursS2p1.pdf
Normal file
BIN
BDcoursS2p1.pdf
Normal file
Binary file not shown.
BIN
BDcoursS2p2.pdf
Normal file
BIN
BDcoursS2p2.pdf
Normal file
Binary file not shown.
@@ -9,17 +9,17 @@ Exercice 1 : Parcours en largeur
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
Pour cet exercice, vous aurez besoin de file FIFO (First In, First Out).
|
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 :
|
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.
|
public boolean isEmpty() : Returns true if this collection contains no elements.
|
||||||
Integer remove() : Retrieves and removes the head (first element) of this list.
|
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 :**
|
**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);
|
public LinkedList<Integer> getVoisins(int i);
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user