next up previous contents
Next: Worst versus average Up: How to measure efficiency Previous: How to measure efficiency   Contents

Time versus space complexity

When creating software for serious application, there often is a need to judge how quickly a program can fulfil a number of tasks. It certainly has to be ensured that the waiting time is reasonable--if, for example, you are programming a flight booking system it is not acceptable if the travel agent and customer have to wait for half an hour for transactions. We call this performance criterion `time complexity'.

The second criterion that is customarily used to determine efficiency is concerned with how much of the memory a given program will need for a particular task. Here we speak of `space complexity'. For a given task, there typically are algorithms which trade time for space, or vice versa. For example, we have seen that hash tables have a very good time complexity at the expense of using more memory than is needed by other algorithms. It is up to the program designer to decide which is the better trade-off for the situation at hand.


next up previous contents
Next: Worst versus average Up: How to measure efficiency Previous: How to measure efficiency   Contents
Martin Escardo 2005-01-11