Steven Shen · @Stevenpotato
54 followers · 409 posts · Server mastodon.social

Programmer joke: Alice and Bob each wrote an algorithm that can only sort the size of solar system planets. Alice came up with one that takes 0.1*n*log(n) milliseconds and got a job in Silicon Valley. Bob came up with one that take 5*n decades and got a tenure at a university and won a Turing award.

#cs #algorithm #bigo #timecomplexity

Last updated 2 years ago

mc ☕ · @mc
84 followers · 808 posts · Server qoto.org

Time Complexity (Big O) simplified:

- When your calculation is not dependent on the input size, it is a constant time complexity (O(1)).
- When the input size is reduced by half, maybe when iterating, handling recursion, or whatsoever, it is a logarithmic time complexity (O(log n)).
- When you have a single loop within your algorithm, it is linear time complexity (O(n)).
- When you have nested loops within your algorithm, meaning a loop in a loop, it is quadratic time complexity (O(n^2)).
- When the growth rate doubles with each addition to the input, it is exponential time complexity (O2^n).

#timecomplexity #bigo #programming #code #complexity

Last updated 2 years ago