Worst-Case Complexity

In computer science (specifically computational complexity theory), the worst-case complexity measures the resources (e.g.

running time, memory) that an algorithm requires given an input of arbitrary size (commonly denoted as n in asymptotic notation). It gives an upper bound on the resources required by the algorithm.

In the case of running time, the worst-case time complexity indicates the longest running time performed by an algorithm given any input of size n, and thus guarantees that the algorithm will finish in the indicated period of time. The order of growth (e.g. linear, logarithmic) of the worst-case complexity is commonly used to compare the efficiency of two algorithms.

The worst-case complexity of an algorithm should be contrasted with its average-case complexity, which is an average measure of the amount of resources the algorithm uses on a random input.

Definition

Given a model of computation and an algorithm Worst-Case Complexity  that halts on each input Worst-Case Complexity , the mapping Worst-Case Complexity  is called the time complexity of Worst-Case Complexity  if, for every input string Worst-Case Complexity , Worst-Case Complexity  halts after exactly Worst-Case Complexity  steps.

Since we usually are interested in the dependence of the time complexity on different input lengths, abusing terminology, the time complexity is sometimes referred to the mapping Worst-Case Complexity , defined by the maximal complexity

    Worst-Case Complexity 

of inputs Worst-Case Complexity  with length or size Worst-Case Complexity .

Similar definitions can be given for space complexity, randomness complexity, etc.

Ways of speaking

Very frequently, the complexity Worst-Case Complexity  of an algorithm Worst-Case Complexity  is given in asymptotic Big-O Notation, which gives its growth rate in the form Worst-Case Complexity  with a certain real valued comparison function Worst-Case Complexity  and the meaning:

    Worst-Case Complexity 

Quite frequently, the wording is:

  • „Algorithm Worst-Case Complexity  has the worst-case complexity Worst-Case Complexity .“

or even only:

  • „Algorithm Worst-Case Complexity  has complexity Worst-Case Complexity .“

Examples

Consider performing insertion sort on Worst-Case Complexity  numbers on a random-access machine. The best-case for the algorithm is when the numbers are already sorted, which takes Worst-Case Complexity  steps to perform the task. However, the input in the worst-case for the algorithm is when the numbers are reverse sorted and it takes Worst-Case Complexity  steps to sort them; therefore the worst-case time-complexity of insertion sort is of Worst-Case Complexity .

See also

References

  • Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms, Second Edition. MIT Press and McGraw-Hill, 2001. ISBN 0-262-03293-7. Chapter 2.2: Analyzing algorithms, pp.25-27.
  • Oded Goldreich. Computational Complexity: A Conceptual Perspective. Cambridge University Press, 2008. ISBN 0-521-88473-X, p.32.

Tags:

Worst-Case Complexity DefinitionWorst-Case Complexity Ways of speakingWorst-Case Complexity ExamplesWorst-Case ComplexityAlgorithmBig O notationComputational complexity theoryComputer memoryComputer scienceSystem resource

🔥 Trending searches on Wiki English:

Percy Hynes WhiteEli ManningBreaking BadNick Young (basketball)Wrexham A.F.C.Hades IIGeorge IIICaitlin ClarkYouTube PremiumYouTube (YouTube channel)Marianne BachmeierHi-Fi RushBack to Black (film)Secretariat (horse)IranLuka DončićT. J. McConnellIan GelderSexual intercourseMckenna Grace2024 Indian Premier LeagueList of European Cup and UEFA Champions League finalsAntisemitismMaldivesSerbiaJak JonesWhoopi GoldbergCasemiroCanelo ÁlvarezAtomic bombings of Hiroshima and NagasakiSaudi ArabiaAlpha Dog GamesTaiwanHades (video game)XXX (2002 film)SwitzerlandAditi Rao HydariAyo EdebiriNapoleonThe Roast of Tom BradyEvil (TV series)Sudha ReddyJean-Philippe MatetaJimmy CarterVash (film)UEFA Euro 2024BotswanaPrajwal RevannaWikiTom ThibodeauJaden McDanielsKatrina LawLea MichelePerplexity.ai2024 Andhra Pradesh Legislative Assembly electionSteve JobsVitinha (footballer, born February 2000)Manisha KoiralaJujutsu KaisenKris JennerCount BinfaceJ. ColeDeaths in 2024Marie-Thérèse KaiserTom SelleckShoshanna Lonstein GrussDoctor WhoJenna OrtegaOttoman EmpireHTTP cookieSabrina CarpenterElle FanningDana WhiteDiane LaneJ. Robert OppenheimerYodha (2024 film)🡆 More