Constant time

A constant time function is one which takes the same amount of time to execute, irrespective of the size of the input that is passed into the function:

function square(num) {
return num*num;
}

The preceding code snippet is an example of a constant time function and is denoted by O(1). Constant time algorithms are the most sought out algorithms for obvious reasons, such as them running in a constant time, irrespective of the size of the input. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.75.183