Lesson 7.2 · Answer it
Word finder growth
5 marksYou mark it yourself against the marking points
Three apps look up a word in a dictionary of n words. App P is O(n), app Q is O(log n) and app R is O(1). Assume each app's steps grow exactly as its class says.
(a) State what happens to the number of steps app P takes when n doubles. [1]
(b) State what happens to the number of steps app Q takes when n doubles. [1]
(c) State what O(1) means for app R as the dictionary grows. [1]
(d) The dictionary grows from 1000 words to 1000000 words, which is 1000 times as many. Explain which of apps P and Q copes better with this growth, using how the steps of each one change. [2]
[5]