big o - Big O algorithms minimum time -


i know problems, no matter algorithm use solve it, there minimum amount of time required solve problem. know bigo captures worst-case (maximum time needed), how can find minimum time required function of n? can find minimum time needed sorting n integers, or perhaps maybe finding minimum of n integers?

what looking called best case complexity. kind of useless analysis algorithms while worst case analysis important analysis , average case analysis used in special scenario.

the best case complexity depends on algorithms. example in linear search best case is, when searched number @ beginning of array. or in binary search in first dividing point. in these cases complexity o(1).

for single problem, best case complexity may vary depending on algorithm. example lest discuss basic sorting algorithms.

  1. in bubble sort best case when array sorted. in case have check element sure. best case here o(n). same goes insertion sort
  2. for quicksort/mergesort/heapsort best case complexity o(n log n)
  3. for selection sort o(n^2)

so above case can understand complexity ( whether best , worst or average) depends on algorithm, not on problem


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -