Given is an array
The task is to color the elements with three colors such that each
S that represents the successors in a linked list:
a list 2 -> 3 -> 0 -> 4 -> 5 -> 1 is represented by an
array
i |
0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
S[i] |
4 | 2 | 3 | 0 | 5 | 1 |
v
has different color than p[v], e.g. to produce an array C:
i |
0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
C[i] |
0 | 1 | 0 | 1 | 1 | 0 |