Algorithm related desciptions, Study notes of Computer Science

notes - Algorithm related desciptions

Typology: Study notes

2018/2019

Uploaded on 12/04/2019

hodmca
hodmca 🇮🇳

1 document

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Algorithm related desciptions and more Study notes Computer Science in PDF only on Docsity!

Problem Solving Process

Step 1 - Analyze the problem

Outline the problem and its requirements Design steps (algorithm) to solve the problem

Step 2 - Implement the algorithm

Implement the algorithm in code Verify that the algorithm works

Step 3 - Maintenance

Use and modify the program if the problem domain changes

What is an algorithm?

The idea behind the computer program

Stays the same independent of

Which kind of hardware it is running on Which programming language it is written in

Solves a well-specified problem in a general

way

Is specified by

Describing the set of instances (input) it must work on Describing the desired properties of the output

What is an algorithm? (Cont’d)

Before a computer can perform a task, it must

have an algorithm that tells it what to do.

Informally: “An algorithm is a set of steps that

define how a task is performed.”

Formally: “An algorithm is an ordered set of

unambiguous executable steps, defining a

terminating process.”

Ordered set of steps: structure! Executable steps: doable! Unambiguous steps: follow the directions! Terminating: must have an end!

Important Properties of Algorithms

Correct

always returns the desired output for all legal instances of the problem.

Unambiguous

Precise

Efficient

Can be measured in terms of  (^) Time  (^) Space Time tends to be more important

Representation of Algorithms

A single algorithm can be represented in

many ways:

Formulas: F = (9/5)C + 32 Words: Multiply the Celsius by 9/5 and add 32. Flow Charts. Pseudo-code.

In each case, the algorithm stays the same;

the implementation differs!

Pseudocode

Pseudocode is like a programming language

but its rules are less stringent.

Written as a combination of English and

programming constructs

Based on selection (if, switch) and iteration (while, repeat) constructs in high-level programming languages

Design using these high level primitives

Independent of actual programming language