Functions and Their Growth

This lesson discusses the building blocks for analyzing algorithms.

The yardstick to measure the performance of algorithms is specified in terms of functions. For the mathematically uninitiated, we explain functions below.

Functions

Think of a function like a machine or a blackbox that takes inputs from one end and spits outputs from the other end.

Function is just a black-box that takes in an input and spits out a result denoted by f(x)
Function is just a black-box that takes in an input and spits out a result denoted by f(x)

Let's consider the following function:

f(n)=n2f ( n ) = n^2

This is the traditional format of expressing a function, with n as the input fed to the "machine". The output of the "machine" is expressed in terms of the input; in the above function, the output is n2 defined in terms of the input n. The input n variable can take on different values and the output will vary accordingly. The below table captures the output values generated when n takes on different interger ...

Access this course and 1400+ top-rated courses and projects.