You are on page 1of 2

DATA STRUCTURE

.....................................
DATA: Data is Rawfact which describes the properties of an object.
..........
INFORMATION: Information the process the data an organised Data.
............................
==>The Raw data which is converted in to the valuable data is known as
information.
==>Its is branch of computer science where it deals with organising data and
maintaing the data.
==>It is basically use to convert Raw data in to useful information.
==>Through DataStructure the complecity of a program can be managed the efficiency
can be increased.
==>Data Structures acts like the building blocks of a programming language using
these building blocks at combining the code
we can create an efficient program.
An efficiency of a program can be measured in to two things.
1)space complexity
2)Time complexicity.

1) SPACE COMPLEXICITY: it is measure of the maximum space consumed by the program


Respective
====================
with change of input.
==>Space complexity can be measured by using Big O notation and it can be
respresented as an expression
using Big O notation but compared to space complexity time complexity is important
and that should be managed
2)Time Complexity: IT is the measure of maximum time taken by a program respective
with change the input to generate
the final output.
Time complexity is the basic complexity measure where all the the developers aware
of to create
an efficient program.
Time complexity is measured in 3 cases
1. BEST CASE 2. AVERAGE CASE 3. WORST CASE
1)BEST CASE: IT IS MINIMUM time taken by the program along with min input to genate
final output.
2)Average CASE: It is moderate time taken by the code to generate output.
3)Worst CASE: It is Max time time taken by the program the max input the genrate
final o/p.
Note: The time complexicity of Program will be represented Big O notation and the
expression which denotes
Time complexity of a program will be based on worst case
Big O notation is the mathematical calculation which is used to represent the
complexity of a program.
Caluculation of time complexity in various Program.
...................................................................................
....

Time complexity in sequential program:


...................................................................

In sequential programs the input does not play any role changing execution time.
Always the o/p will be
generated to the same interval of time irrespective i/p time. Hence the time
complexity will be Big O(1).
which means constant.
ex: a=5
b=2
print(a+b)

TIME COMPLEXITY IN CONDITIONAL STATEMENTS:


In cod statements if else statement genrates the o/p the same interval of time
irresprctive of the input. Hence the
Time comp of Big O (1). But in elif statements and nested if statements as the
input varies even the time taken
the o/p genrates. hence the time complxities of these statements is Big O (n)

ex: a=0
if a>0:
print('+ve)
elif a<0:
print('-ve')
else:
print('neutral')

Time complexity in single looping statement:


.........................................................................
if the program has single looping statements then it takes N units of time to
genrate of final o/p. Hence the
time complexity Big O (n) But nested loops it takes N square units of time to
execute the program completely
Hence the complexity is Big O (n^2).

You might also like