0% found this document useful (0 votes)
34 views8 pages

Introduction To Algorithm: Algorithm Deign and Analysis

This document discusses algorithms and their characteristics. It compares algorithms to programs and prior analysis to posterior testing. Algorithms must have inputs, outputs, definiteness, finiteness, and effectiveness. They can be represented through flowcharts or pseudocode. Writing algorithms involves defining the problem, designing the steps to solve it, and expressing those steps clearly.

Uploaded by

Rohulhuda Afghan
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)
34 views8 pages

Introduction To Algorithm: Algorithm Deign and Analysis

This document discusses algorithms and their characteristics. It compares algorithms to programs and prior analysis to posterior testing. Algorithms must have inputs, outputs, definiteness, finiteness, and effectiveness. They can be represented through flowcharts or pseudocode. Writing algorithms involves defining the problem, designing the steps to solve it, and expressing those steps clearly.

Uploaded by

Rohulhuda Afghan
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/ 8

Introduction to

Algorithm
ALGORITHM DEIGN AND ANALYSIS

PREAPARED BY: ABDUL JALIL NIAZAI


Continue…
Algorithm VS Program

1. Design 1. Implementation
2. Domain Knowledge 2. Programmer
3. Any Language 3. Programing language
4. Independent of hardware & OS 4. Dependent of hardware & OS
5. Analyze 5. Testing

PREAPARED BY: ABDUL JALIL NIAZAI


Continue…
Priori Analysis VS Posterior testing

1. Algorithm 1. Program
2. Independent of language 2. Language Dependent
3. Hardware Independent 3. Hardware Dependent
4. Time and Space function 4. Watch time & Bytes

PREAPARED BY: ABDUL JALIL NIAZAI


Characteristic of an Algorithm
Following are the characteristics that an algorithm must have:

1. Input: Each and every algorithm must have an input. It may be zero or some thing
else, i.e. input is necessary.
2. Output: The algorithm will generate result after processing the input.
3. Definitiveness: Each and every Instruction must be cleared and simple that can be
understand by every one.
4. Finiteness: Each algorithm must have proper starting and ending.
5. Effectiveness: Before preparing any algorithm, firstly it should be sketch on the papers.

PREAPARED BY: ABDUL JALIL NIAZAI


Representation of Algorithm
Representation of algorithm is taken place into two ways.
1) Flowchart
2) Pseudocode

PREAPARED BY: ABDUL JALIL NIAZAI


Continue…
.
Flowchart: A flowchart is a visual representation of an
algorithm's control flow.
To present that visual representation, a flowchart uses
various symbols.

PREAPARED BY: ABDUL JALIL NIAZAI


How to Write an Algorithm
Pseudo code: A textual representation of an algorithm that approximates the final source code.
Example 1: A simple algorithm to swap the values of two variables.

Algorithm swap( a, b)
{
temp = a
a=b
b = temp
}

PREAPARED BY: ABDUL JALIL NIAZAI


Continue…
Example 2:

DECLARE INTEGER ch=0


DECLARE INTEGER count=0
DO
READ ch
IF ch IS ‘0’ THROUGH ‘9’ THEN
count++;
END IF
UNTIL ch IS ‘\n’
PRINT count
END

PREAPARED BY: ABDUL JALIL NIAZAI

You might also like