March 2020
Intermediate to advanced
406 pages
8h 39m
English
If we take a sample dataset of 32 input values, we can quickly calculate the amount of time it's going to take for each of our algorithms to complete. You'll notice that the unit time to complete in the following table starts to grow very quickly. The practical Big O notation values are as follows:
|
Algorithm |
Unit time to complete |
|
O(1) |
1 |
|
O(log n) |
5 |
|
O(n) |
32 |
|
O(n log n) |
160 |
|
O(n2) |
1,024 |
|
O(2n) |
4,294,967,296 |
As the unit time to complete gets larger, our code becomes less performant. We should strive to use the simplest algorithm possible to solve the dataset that we have at hand.
Read now
Unlock full access