-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.8Algorithm_info.c
49 lines (41 loc) · 1.15 KB
/
1.8Algorithm_info.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
int main(int argc, char const *argv[])
{
/*
Algorithm=An Algorithm Is The Step By Step Instructions To Solve A Given Problem....
Observe Here Guys:-
Algorithm To Add First N Natural Numbers .Assume x Is A Variable Initialized To 0
1 If n<=0 return -1
2 Repeat Step 3 And 4 while n!=0
3 x=x+n
4 [Decrement n]n--
5 return x
*/
/*
ANALYSIS OF ALGORITHM
The goal of analysis is Algorithm is to compare alogorithms mainly in terms of running time but also in terms of other factors(like memory,efforts etc)
*/
/*
RATE OF GROWTH
The rate at which the running time increases as a function of input is called rate of growth
like:-Time=f(n) and n=numbers of inputs
f(n)=n4+2n4+100n+500 //means n ki power 4
f(n)=n4+ for some n>n0
*/
/*
To analyse the given alogorithm we need to know on what inputs the alogorithm is taking less time and on what inputs the algorithm is taking huge time.
3 Cases occurs
--Wrost case
--Average case
--Best case
*/
/**
ASYMPTOTIC NOTATIONS
For all the three cases we need to identify the upper and lower bounds.
Syntaxs of representation of bounds are
-Big-O-Notation
-Omega-Notation
-Theta-Notation
*/
//by Navjot Singh Prince:)
return 0;
}