This file contains the exercises, hints, and solutions for Chapter 1 of the
book ”Introduction to the Design and Analysis of Algorithms,” 3rd edition, by
Exercises 1.1
1. Do some research on al-Khorezmi (also al-Khwarizmi), the man from
whose name the word “algorithm” is derived. In particular, you should
learn what the origins of the words “algorithm” and “algebra” have in
common.
5. Design an algorithm to find all the common elements in two sorted lists
of numbers. For example, for the lists 2, 5, 5, 5 and 2, 2, 3, 5, 5, 7, the
output should be 2, 5, 5. What is the maximum number of comparisons
your algorithm makes if the lengths of the two given lists are and
respectively?
8. What does Euclid’s algorithm do for a pair of integers in which the first
is smaller than the second? What is the maximum number of times this
can happen during the algorithm’s execution on such an input?