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

Lecture - 02 - Fundamentals of Algorithmic Problem Solving

The document discusses the importance of studying algorithms despite advancements in computer speed, highlighting the significant differences in performance between various algorithms like Bubble Sort and Merge Sort. It outlines key properties of algorithms, such as input, output, precision, finiteness, definiteness, correctness, and generality. Additionally, it introduces the STAIR method for problem-solving, emphasizing a structured approach to developing solutions.

Uploaded by

fk123q
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Lecture - 02 - Fundamentals of Algorithmic Problem Solving

The document discusses the importance of studying algorithms despite advancements in computer speed, highlighting the significant differences in performance between various algorithms like Bubble Sort and Merge Sort. It outlines key properties of algorithms, such as input, output, precision, finiteness, definiteness, correctness, and generality. Additionally, it introduces the STAIR method for problem-solving, emphasizing a structured approach to developing solutions.

Uploaded by

fk123q
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

DESIGN AND ANALYSIS OF ALGORITHMS

Dr. Kashif Ayyub


1
Algorithms as Technology
• If computers were infinitely fast and computer memory were free, would you have any reason to study algorithms? The
answer is yes, Of course, computers may be fast, but they are not infinitely fast. Computing time is therefore a bounded
resource, which makes it precious.
• Problem: Sorting n values
• Input Size: 107 numbers (10 million)
• Computer – A is 1000 times faster than Computer - B
Computer – A Computer – B
Speed 1010 inst/sec 107 inst/sec
Algorithm Bubble Sort Merge Sort
Complexity 2n2 50nlgn
Programmer World’s Best Average
Language Machine High-Level
2 x (107)2 inst 50 x 107 x lg107 inst
1010 inst/sec 107 inst/sec
= 20,000 seconds = 1,163 seconds
= more than 5.5 hours = less than 20 minutes 2
Representation of an Algorithm
• An algorithm can be represented in many ways, for example, a GCD aglorithm

3
Properties of an Algorithm
• Input: An algorithm requires one or more inputs. The values that are first supplied to the algorithm
before its processing are known as inputs. These inputs come from a predetermined range of
acceptable values.
• Output: One or more outputs must be produced by an algorithm. The output is the outcome of the
algorithm after every step has been completed. The relationship between the input and the result
should be clear.
• Precision: The steps must be precisely stated.
• Finiteness: An algorithm must terminate after a finite number of steps in all test cases. Every
instruction which contains a fundamental operator must be terminated within a finite amount of time.
• Definiteness: All instructions in an algorithm must be unambiguous, precise, and easy to interpret. By
referring to any of the instructions in an algorithm one can clearly understand what is to be done.
• Correctness: The algorithm should produce correct results for all possible input data.
• Generality: Rather than being limited to a single particular case, an algorithm should be able to solve a
group of issues. It should offer a generic fix that manages a variety of inputs inside a predetermined
range or domain.

4
Problem-Solving: An Art and a Science
• Problem-solving can be seen as more of an art than a science.
• Each person has different ways of approaching problems.

5
STAIR Steps for Solving Problems
• STAIR is an acronym designed to guide your problem-solving process.
• Each letter represents a critical step in developing a solution.
• S - State the problem
• T - Tools for the job
• A - Algorithm development
• I - Implementation of the algorithm
• R - Refinement

You might also like