Basic Concept of Data Structures
Basic Concept of Data Structures
Badharudheen P
Assistant Professor,
Dept. of CSE, MESCE, Kuttippuram
System Life Cycle
The system life cycle is a series of stages that are
worked through during the development of a new
information system.
Method:
Meet with end-users, or clients, describe exactly what
the output should look like.
Analysis Phase
The problem is break down into manageable pieces.
There are two approaches for analysis:-
Bottom up and Top down.
Bottom up approach is an older, unstructured
strategy.
Top down approach is a structured approach divide
the program into manageable segments.
Several alternate solutions to the problem are
developed and compared during this phase
Design Phase
The designer approaches the system from the
perspectives of both data objects and the operations.
The first perspective leads to the creation of abstract
data types while the second requires the specification
of algorithms.
Time Complexity
Space Complexity
Analysis of space complexity of a program is the
amount of memory it needs to run to completion.
T(P) = C + TP
Ω: Big-omega Notation
Lower bound of a function
Ө: Big-theta Notation
Average bound of a function
O: Big-oh Notation
It is used to represent the worst case complexity.
Definition: The function f(n) = O(g(n)) iff, Ǝ
positive constants c and n0 such that
f(n) ≤ c * g(n) ∀ n ≥ n0
time
n
O: Big-oh Notation
Example: f(n) = 2n + 3, g(n) = n
=> 2n + 3 ≤ c * g(n)
2n + 3 ≤ 5 * n c=5, for all n≥1
=> f(n) = O(g(n))
Note: You can take any value for ‘c’, but make sure that right
hand side should be greater than the left hand side for some
starting value of ‘n’.
Or you can write it as 2n + 3 ≤ 2n + 3n
=> 2n + 3 ≤ 5n for all n ≥ 1
Or you can write it as 2n + 3 ≤ 2n2 + 3n2
=> 2n + 3 ≤ 5n2 for all n ≥ 1
O: Big-oh Notation
Example: f(n) = 3n + 2, g(n) = n
=> 3n + 2 ≤ c * g(n)
3n + 2 ≤ 4 * n c=4 for all n ≥ 2
=> f(n) = O(g(n))
Note: If ‘n’ is bounding the function f(n), definitely n2, n3, etc will
also bound. So always go for least upper bound.
So we can say that f(n) = O(n), f(n) = O(n2)
But f(n) ≠ O(log n)
Ω: Big-omega Notation
The function f(n) = Ω(g(n)) iff, Ǝ positive
constants c and n0 such that
f(n) ≥ c * g(n) ∀ n ≥ n0
time
n
Ω: Big-omega Notation
Example: f(n) = 2n + 3, g(n) = n
=> 2n + 3 ≥ c * g(n)
2n + 3 ≥ 1 * n c=1, for all n≥1
=> f(n) = Ω(g(n))
Hence f(n) = Ω(g(n))
Note: You can take any value for ‘c’, but make sure that right
hand side should be less than the left hand side for some starting
value of ‘n’.
Or you can write it as 2n + 3 ≥ log n for all n ≥ 1
Ө: Big-theta Notation
The function f(n) = Ө(g(n)) iff, Ǝ positive
constants c1, c2 and n0 such that
c1*g(n) ≤ f(n) ≤ c2*g(n) ∀ n ≥ n0
time
n
Ө: Big-theta Notation
Example: f(n) = 2n + 3, g(n) = n
Already we found that
1 * n ≤ 2n + 3 ≤ 5 * n for all n≥1