Fundamentals of-algorithm

12
Fundamentals of algorithm SUNAWAR KHAN MSCS IIUI

Transcript of Fundamentals of-algorithm

Page 1: Fundamentals of-algorithm

Fundamentals of algorithm

SUNAWAR KHAN MSCS

IIUI

Page 2: Fundamentals of-algorithm

Origin of Word algorithm

The word Algorithm comes from the name of the muslim author Abu Ja’far Mohammad ibn Musa al-Khowarizmi. He was born in the eighth century at Khwarizm (Kheva), a town south of river Oxus in present Uzbekistan.

Uzbekistan, a Muslim country for over a thousand years, was taken over by the Russians in 1873.

Page 3: Fundamentals of-algorithm

Origin of Word algorithm

His year of birth is not known exactly. Al-Khwarizmi parents migrated to a place south of Baghdad when he was a child.

It has been established from his contributions that he flourished under Khalifah Al-Mamun at Baghdad during 813 to 833 C.E. Al-Khwarizmi died around 840 C.E.

Page 4: Fundamentals of-algorithm

Origin of Word algorithm

Much of al-Khwarizmi’s work was written in a book titled al Kitab al-mukhatasar fi hisab al-jabr wa’l-muqabalah (The Compendious Book on Calculation by Completion and Balancing).

It is from the titles of these writings and his name that the words algebra and algorithm are derived. As a result of his work, al-Khwarizmi is regarded as the most outstanding mathematician of his time

Page 5: Fundamentals of-algorithm

Algorithm: Informal Definition

An algorithm is any well-defined computational procedure that takes some values, or set of values, as input and produces some value, or set of values, as output.

An algorithm is thus a sequence of computational steps that transform the input into output.

Page 6: Fundamentals of-algorithm

Algorithms, Programming

A good understanding of algorithms is essential for a good understanding of the most basic element of computer science: programming

Unlike a program, an algorithm is a mathematical entity, which is independent of a specific programming language, machine, or compiler.

Thus, in some sense, algorithm design is all about the mathematical theory behind the design of good programs

Page 7: Fundamentals of-algorithm

Characteristics of algorithm

It should be finite: If your algorithm never ends trying to solve the problem it was designed to solve then it is useless.

It should have well defined instructions: Each step of the algorithm has to be precisely defined; the instructions should be unambiguously specified for each case.

Page 8: Fundamentals of-algorithm

Characteristics of algorithm

It should be effective: The algorithm should solve the problem it was designed to solve. And it should be possible to demonstrate that the algorithm converges with just a paper and pencil.

Page 9: Fundamentals of-algorithm

Example from daily life

Buy some food from super market

Making tea

Page 10: Fundamentals of-algorithm

Representation of algorithms

There are to ways to represent an algorithm

Flow Charts Pseudocode

Page 11: Fundamentals of-algorithm

Flowcharts

A flowchart is a type of diagram that uses an algorithm, workflow or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows.

Page 12: Fundamentals of-algorithm

This diagrammatic representation

This diagrammatic representation illustrates a solution model to a given problem