Algorithms


Contrast with sequential search.

In particular, there is no early exit from finding the largest algorithm.

How is this algorithm an example of divide and conquer?

Answer: Find largest in A1, A2, ..., Ai, Ai+1 by finding the largest in A1, A2, ..., Ai and comparing that to Ai+1.


QUESTION: In the previous two algorithms what would happen if, in the telephone book algorithm there were more than two persons with the same name, or in the find largest there were two locations with the same largest value?

How would you modify these algorithms to provide a better solution?

In these two cases do the algorithms fail the five-part test because they are incomplete solutions?


[Prev][TOC][Next]


CS1104 Main Page
Last Updated 01/05/2000
© L.Heath, 2000