**890**wrote:

Dear all,

Please could you advise on an algorithm that could solve a relatively easy problem (I have just started recalling and reviewing very old informatics classes on graph theory, recursion and dynamic programming).

the computational problem is : considering a sequence of pairs of type `(X, Y)`

,for example:

```
(A, B)
(C, D)
(B, E)
(Z, T)
(W, A)
(G, T)
(Z, I)
```

What is the optimal strategy to connect these pairs of letters into a sequence :

```
W -- > A, A -->B, B --> E.
```

Thank you very much,

Bogdan