Skip to content

AlgorithmsMeetup/TimeComplexity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Time Complexity

Efficiency vs. Performance: Or what are we talking about exactly?

Hardware and software environments affect how fast a program runs. Efficiency or time complexity allows us to compare algorithms in an environment-agnostic manner and is measured in terms of operational steps taken and space required.

What problem does this solve?

Despite advances in computing hardware, tasks such as factoring still take an unwieldy/prohibitive amount of time. In fact, "A faster algorithm running on a slower computer will always win for sufficiently large instances. [...] Usually, problems don’t have to get that large before the faster algorithm wins". "In order to make most effective use of our computational resources, it's important that we have the skill set to analyze the complexity of algorithms, so we know what resources those algorithms require. Being able to analyze an algorithm allows us to have an idea of how well it scales as we throw larger and larger data sets at it."

"It was the best of times, it was the worst of times...": Asymptotic Notation

Time complexity is described using asymptotic notation:

  • Big-Theta: asymptotically tight bound
  • Big-Omega: asymptotic lower bound or best-case scenario
  • Big O: asymptotic upper bound or worst-case scenario

and is primarily discussed in terms of Big O notation.

See: https://learnxinyminutes.com/docs/asymptotic-notation/

For example, linear searching of an array is Ω(1) for Big-Omega (finds it upon inspecting the first element) and and O(n) for Big O (never finds it).

Loop-de-loop: Big O Runtimes

Different Big O runtimes to measure algorithms include:

Big O Chart

Check this helpful stack overflow post for a description of some of these.

Rules to live by

  • Add different steps
  • Drop constants
  • Different inputs --> different variables
  • Drop non-dominant terms

Watch: Big O Notation

TODO

  • Recursive time complexity

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published