DEV Community

Discussion on: Visualizing Algorithm Runtimes in Python

Collapse
 
legrady profile image
Tom Legrady

Unfortunately the section on runtime complexity has a mistake.

Constant runtime is O(1) ... O(n) is linear runtime. Summing the elements of an array would be linear, since you have to access each element of the array one time.

Collapse
 
chroline profile image
Cole Gawin

Great catch, I made the update right away! The add function given would run in O(1) time, not O(n) time.