Skip to content

Latest commit

 

History

History
20 lines (12 loc) · 748 Bytes

README.md

File metadata and controls

20 lines (12 loc) · 748 Bytes

BigO

The following are examples used in the Big O article.

All these examples require Python 2.7 and Higher in order to work properly.

The following examples are:

  1. Binary Search (binary.py)
  2. Bubblesort (bubblesort.py)
  3. Constant (constant.py)
  4. Linear Search (linear.py)

O(1) is constant, no matter how many elements are added the resulting operation will always be the same time.

O(N) is linear, it increases operations as the number of elements increases in direct proportion.

O(Log N) is logarithmic or half of linear time, it halves the number of operations required given the same elements as O(n).

O(N²) shows the worst case scenario as operations increase steeply with the increase in number of elements, or quadratic time.