Controlled Experiment

In an experiment, we systematically test a system in a controlled environment and measure quantitative data to prove (or disprove) something. When designing an experiment we have to define the dependent and independent variables. The dependent variable is what you measure. The independent variables (can be one or more) are inputs that you modify and that affect the dependent variable (the result).

Example: to answer the question about which of the five sorting algorithms that are the fastest we can use an experiment. We have one independent variable: which algorithm that is currently used (bubble, quick, selection, insertion or merge sort). The dependent variable is the execution time. The experiment is repeated for each algorithm, and the choice of algorithm (independent variable) affects the execution time (dependent variable).