Growth of Functions Flashcards
An algorithm that is asymptotically efficient is best choice for all inputs?
No, for small inputs the asymptotic efficeiency is not helpful. for small inputs insertion sort o(n^ 2) is faster than merge sort n(logn)
what are all the notation used to describe asympototic?
Big-O Notation (O),Omega Notation (Ω),Theta Notation (Θ),Little-o Notation (o),Little-Omega Notation (ω)
Big-O notation
Big-O notation describes the upper bound of an algorithm’s growth rate. It gives the worst-case time or space complexity.
Mathematical Representation:
f(n)=O(g(n)) if there exist constants
c>0 and 𝑛0≥0
such that:
f(n)≤c⋅g(n),foralln≥n0
.
Omega Notation (Ω)
Omega notation describes the lower bound of an algorithm’s growth rate. It gives the best-case time or space complexity.
Mathematical Representation:
f(n)=Ω(g(n)) if there exist constants
c>0 and 𝑛0≥0
such that:
f(n) ≥ c⋅g(n),foralln≥n0
Theta Notation (Θ)
Theta notation describes the tight bound of an algorithm’s growth rate. It bounds the algorithm from above and below, describing its exact asymptotic behavior.
Mathematical Representation:
f(n)=Θ(g(n)) if there exist constants
c1,c2>0 and n0≥0
c 1. g(n)≤f(n)≤c2 ⋅g(n),
foralln≥n 0
.
Can we use all notation to specify running times?
Yes, but we need to mention precisely is good practice. for example we can say worst case running time of insertion sort in Big O(n^2), Omega(n^2),Theta(n^2), but Theta is most suited since running time is tightly bounded
Little O
it refer to running is stricly lower than inputs. Bigoh means is equal to or slower.
ω (Little-Omega)
strictyl faster than inputs,
Big omega is atleast it will run for the inputs