1 Intro To Data-Structures
1 Intro To Data-Structures
ALGORITHMS
Department of CCE
Click to add text
INTRODUCTION
DATA SRUCTURE
THREE ACTIVITIES:
Storing,
Accessing,
Manipulating ,
TYPES OF DATA STRUCTURE
Two types of data structures:
they are
1) Primitive data structure.
int , char, float.
2) Non-Primitive data structure.
1. Arrays
2. Structure
3. Stack
4. Queue
5. Linked list
6. Tree
7. Graph
8. Files.
1) ALGORITHMS
1.1 Definition:
An algorithm consists of a set of explicit and
unambiguous, finite steps when carrying out for a
given set of initial condition ,produce corresponding
output and terminate in a finite time.
1.2) Characteristics:
Each instruction should be unique and concise.
Each instruction should be relative in nature and
should not be repeated infinitely.
Repetition of same tasks should be avoided.
The results should be available to the user after the
algorithm terminates.
2) ANALYSIS OF ALGORITHMS
2)Average-case:
The function defined by average number
of steps taken on any problem of size(n).
FORMULA:
T(n)=theta(f(n))
3) Best-case:
The function defined by minimum
number of steps taken on any problem of
size(n).
FORMULA:
T(n)=omega((fn))
4.2) SPACE COMPLEXITY
NOTATION:
A method used to estimate the
efficiency of an algorithm.
1)Big-oh notation.
2)Big-omega notation.
3)Big-theta notation.
5.1) Big-oh notation:
O-> Order of.
Big-> very large values of “n”.
Used to define the worst-case running
time of an algorithm.
Example: f(n)=O(g(n))
f(n) and g(n) -> positive integer.
5.2)
Big-Omega Notation:
Used to define the best-case
running time of an algorithm.
Example: f(n)=Omega(g(n))
f(n) and g(n) -> positive integer.
5.3)
Big-Theta Notation:
It is in between Big-oh and Big-
omega notations.
Example: f(n)=Theta(g(n))
f(n) and g(n) -> positive integer.
3. Big-Theta Notation 1. Big-oh notation 2. Big-Omega Notation
LIMITATIONS OF ASYMPTOTIC
NOTATION:
Many algorithms are hard to analyze
mathematically.
Big-Oh analysis only tells you how it grows
with the size of the problem not how efficient
of the algorithm is.