V | a | b | c | Values found |
We have a problem! We've got the order that the different values were found, and how many of each there were. But we want the output in value order, not in the order each value was found in the unsorted input. Fortunately there's a trick that will help us. |
|||||
---|---|---|---|---|---|---|---|---|---|---|
B | 0 | 2 | 1 | Order they were found | ||||||
C | 3 | 2 | 2 | How many found | ||||||
L | 0 | 1 | 0 | 2 | 1 | 2 | 0 | Order in which each input element's value was found |
B-1 | 0 | 2 | 1 | Order in which they belong |
---|
X | 0 | 5 | 3 | Where the next one goes |
---|