Data Structures, Algorithms, & Applications in C++
Chapter 2, Exercise 35
No, a program can exhibit its worst-case time behavior on one input and its
worst-case space behavior on another.
For example, we may have two ways to solve the same problem. One may be fast
but uses a lot of space, and the other may be slow and space efficient.
We can combine these two methods into a single program in which the
solution method actually used is selected on the basis of some input
property. Inputs that satisfy this property run fast using worst-case space;
inputs that do not satisfy this property run in worst-case time
but use minimal space.