0% found this document useful (0 votes)
12 views

I MSC Algorithm

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

I MSC Algorithm

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Analysis and design of

algorithm
Introduction
Notion of
Algorithm
Algorithms are a fundamental part of computer science, enabling
the efficient resolution of intricate problems. They provide a step-
by-step approach to solving a problem, often involving repetitive
calculations and decision-making.
Fundamentals of
algorithmic problem
solving
1 Problem Definition 2 Algorithm Design
Clearly define the problem, Choose the appropriate data
including the inputs, desired structures and algorithmic
outputs, and any techniques to solve the
constraints. problem.

3 Algorithm 4 Testing and Analysis


Implementation Thoroughly test the
Translate the algorithm into algorithm with various
a specific programming inputs and analyze its
language, ensuring clarity performance to identify
and efficiency. potential areas for
improvement.
Important problem types
Sorting Searching
Arranging data in a specific Locating a specific element
order, such as ascending or within a dataset, such as
descending. finding a particular value in
an array.

Graph Algorithms Dynamic Programming


Solving problems on graphs, Breaking down a complex
such as finding the shortest problem into smaller
path between two nodes or subproblems and using
determining if a graph is memoization to avoid
connected. redundant calculations.
Fundamentals of the analysis of
algorithm efficiency
Time Complexity Space Complexity

How the runtime of an algorithm scales with the input The amount of memory an algorithm requires to execute.
size.
Analysis framework
1 Step 1: Identify Key Operations
Determine the operations that contribute
significantly to the algorithm's runtime.

2 Step 2: Express Operation Counts


Represent the number of operations performed as a
function of the input size.

3 Step 3: Analyze Asymptotic Behavior


Focus on how the algorithm's runtime scales with
large input sizes.
Asymptotic Notations
and Basic Efficiency
Classes
Notation Definition Example

Big O (O) Upper bound on O(n^2)


the growth rate

Big Omega (Ω) Lower bound on Ω(n log n)


the growth rate

Theta (Θ) Tight bound on Θ(n)


the growth rate
Mathematical analysis
of non-recursive
Algorithms
Step 1: Initialization
Create a new matrix C to store the result, initialized with
zeros.

Step 2: Looping
Iterate through each element of the result matrix,
performing the dot product of the corresponding rows and
columns of the input matrices.

Step 3: Result
The resulting matrix C represents the product of the two
input matrices.
Mathematical analysis of
recursive algorithms
1 Base Case
If there is only one disk, move it directly from the source peg to the
destination peg.

2 Recursive Step
Move the top n-1 disks from the source peg to the auxiliary peg using
the destination peg as the auxiliary.

3 Move the largest disk


Move the largest disk from the source peg to the destination peg.

4 Recursive Step (again)


Move the n-1 disks from the auxiliary peg to the destination peg using
the source peg as the auxiliary.
DIVIDE AND CONQUER &
GREEDY METHOD:-
Greedy method Prim’s
algorithm
Initialization Edge Selection
Start with an empty minimum Repeatedly select the edge with the
spanning tree (MST) and choose an minimum weight that connects a
arbitrary vertex as the starting point. vertex in the MST to a vertex outside
the MST.

Expansion Termination
Add the selected edge and its Continue until all vertices are
corresponding vertex to the MST. included in the MST.
Divide and conquer
Technique Multiplication of
large integers Strassen’s
matrix multiplication

1 Divide and Conquer 2 Recursive Solutions


Break down a problem into Solve the subproblems
smaller subproblems that are recursively using the same
easier to solve. divide-and-conquer approach.

3 Combine Solutions
Combine the solutions to the subproblems to obtain the solution to the
original problem.

You might also like