Solutions to Exercises 1.3
1. a. Sorting 60, 35, 81, 98, 14, 47 by comparison counting will work as
follows:
Array [05] 60 35 81 98 14 47
Initially [] 0 0 0 0 0 0
After pass =0 [] 3 0 1 1 0 0
b. The algorithm is not stable. Consider, as a counterexample, the
result of its application to 10,100
2. Answers may vary but most students should be familiar with sequential
3. Align the pattern with the beginning of the text. Compare the corre-
sponding characters of the pattern and the text left-to right until either
4. a. If we represent each of the river’s banks and each of the two islands by
17