DAA Module-1
DAA Module-1
Algorithms- 21AML144
- Idea of programming
- Basic mathematics
- Concept of data structure
- Graph theory
9. Input and output are done using the instructions read & write.
No format is used to specify the size of input or output quantities
n+3
6/23/2023
Algorithm-1 Pankaja R Dept. of AI&ML,BNMIT
Algorithm-2 Algorithm-3:recursive procedure 42
DAA
DAA
– o(little oh)
Proof:
The proof extends to orders of growth the following simple fact
about four arbitrary real numbers a1, b1, a2, b2:
if a1 ≤ b1 and a2 ≤ b2, then a1 + a2 ≤ 2 max{b1, b2}.
Since t1(n) ∈ O(g1(n)), there exist some positive constant c1 and
some nonnegative integer n1 such that
t1(n) ≤ c1g1(n) for all n ≥ n1.
Proof: (continued):
Let us denote c3 = max{c1, c2} and consider n ≥ max{n1, n2} so
that we can use both inequalities.
Adding them yields the following:
t1(n) + t2(n) ≤ c1g1(n) + c2g2(n)
≤ c3 g1(n) + c3g2(n) = c3[g1(n) + g2(n)]
≤ c32 max{g1(n), g2(n)}.
Hence, t1(n) + t2(n) ∈ O(max{g1(n), g2(n)}), with the constants c
and n0 required by the O definition being 2c3 = 2 max{c1, c2}
and max{n1, n2}, respectively.
• summation formulas
• Some algorithms work faster than others but require more memory;
some are very fast but applicable only to sorted arrays; and so on.
• Also, organizing very large data sets for efficient searching poses
special challenges with important implications for real-life
applications.