Synechron Interview Question

What the difference between O (1) and O (n)

Interview Answer

Anonymous

Feb 17, 2016

Big O-Notation is a way to measure how long the algorithm runs. O(1) or "constant time" means it takes just one step to run. If you have 1 item or 1000 items O(1) will still run it in one step. Whereas O(n) or "linear time" where "n" is the number of items. So if you have 10 items it will print 10 items, if you have 1000 items it will print 1000 times

4