Skip to content

Instantly share code, notes, and snippets.

@zahra-ove
Created February 26, 2024 10:04
Show Gist options
  • Save zahra-ove/b6c74a2c901e06ce3a00c2021cb96128 to your computer and use it in GitHub Desktop.
Save zahra-ove/b6c74a2c901e06ce3a00c2021cb96128 to your computer and use it in GitHub Desktop.

Big-O time complexity:

  1. big O is used to describe the performance of an algorithm. it determines how scalable an algorithm is. ==> we want to figure out how the algorithm slows down as size of arguments grows larger.

run time complexity

O(1) — Constant Time:
O(log n) — Logarithmic Time: The number of steps it takes to accomplish a task are decreased by some factor with each step.
O(n) — Linear Time: The number of of steps required are directly related (1 to 1).
O(n²) — Quadratic Time: The number of steps it takes to accomplish a task is square of n.
O(2^N) — Exponential Time: a algorithm by exponential time complexity is not scalabe at all and become very slow.\

the logarithmic growth slows down as the input growths. the opposite of logarithmic growth is exponential growth.\

in addition to time complexity, there is another concept called space complexity.


Arrays

  1. arrays are the simplest data structure which is used to store list of items.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment