📘
Notes
Blog
Fundamental Algorithms
Fundamental Algorithms
  • Overview
  • Introduction
  • Recurrences
  • Search Trees
  • Dynamic Programming
  • Shortest Paths
  • NP Complete
Powered by GitBook
On this page
  • Exponent rule
  • Log rule
  • Asymptotics
  • Stirling's Approximation
  • Comparison Tree
  • Hasse Diagram

Introduction

Outline of Algorithmics

PreviousOverviewNextRecurrences

Last updated 3 years ago

Exponent rule

(ab)c=abc\begin{gather*} (a^b)^c = a^{bc} \end{gather*}(ab)c=abc​

Log rule

clog⁡a(n)=nlog⁡a(c)\begin{gather*} c^{\log_a(n)} = n^{\log_a(c)} \end{gather*}cloga​(n)=nloga​(c)​

Asymptotics

Name
Notation
Rough Meaning
Definition
In-fix Notation

big-Oh

big-Omega

Theta

small-oh

small-omega

Stirling's Approximation

Original:

Further simplification:

A possible transformation:

Comparison Tree

Hasse Diagram

The lower the smaller, circle(o) for x, cross(×) for y.

2πn(ne)ne112n+1<n!<2πn(ne)ne112n\sqrt{2\pi n}({n \over e})^n e^{1\over{12n + 1}} < n! < \sqrt{2\pi n}({n \over e})^n e^{1\over{12n}}2πn​(en​)ne12n+11​<n!<2πn​(en​)ne12n1​

log(n!)=nlog⁡(n)−n+Θ(log⁡(n))log(n!) = n \log(n) - n + \Theta(\log(n))log(n!)=nlog(n)−n+Θ(log(n))

log(n!)=Θ(nlog⁡(n))log(n!) = \Theta(n \log(n))log(n!)=Θ(nlog(n))

n!=Θ(enlog⁡(n))n! = \Theta(e^{n \log(n)})n!=Θ(enlog(n))

Example: Merge x1<x2x_1 < x_2x1​<x2​ and y1<y2<y3<y4y_1 < y_2 < y_3 < y_4y1​<y2​<y3​<y4​.

g=O(f)g=O(f)g=O(f)
g≤fg \le fg≤f
(∃C>0)[Cf≥g≥0(e.v.)](\exists C > 0)[C f \ge g \ge 0(e.v.)](∃C>0)[Cf≥g≥0(e.v.)]
g⪯fg \preceq fg⪯f
g=Ω(f)g=\Omega(f)g=Ω(f)
g≥fg \ge fg≥f
(∃C>0)[Cg≥f≥0(e.v.)](\exists C > 0)[C g \ge f \ge 0(e.v.)](∃C>0)[Cg≥f≥0(e.v.)]
g⪰fg \succeq fg⪰f
g=Θ(f)g=\Theta(f)g=Θ(f)
g=fg = fg=f
(∃C>1)[C2f≥Cg≥0(e.v.)](\exists C > 1)[C^2 f \ge C g \ge 0(e.v.)](∃C>1)[C2f≥Cg≥0(e.v.)]
g≍fg \asymp fg≍f
g=o(f)g=o(f)g=o(f)
g≪fg \ll fg≪f
(∀C>0)[Cf≥g≥0(e.v.)](\forall C > 0)[C f \ge g \ge 0(e.v.)](∀C>0)[Cf≥g≥0(e.v.)]
g≪fg \ll fg≪f
g=ω(f)g=\omega(f)g=ω(f)
g≫fg \gg fg≫f
(∀C>0)[Cg≥f≥0(e.v.)](\forall C > 0)[C g \ge f \ge 0(e.v.)](∀C>0)[Cg≥f≥0(e.v.)]
g≫fg \gg fg≫f
Asymptotics Notations
Decision Tree Example
Hasse Diagram Example