Basics of Algorithm
Basics of Algorithm
PART-I
Amit Das, [email protected], [email protected]
WHAT IS ALGORITHM?
The dictionary meaning of ALGORITHM: a process or set of rules to be followed in calculations or other problem solving operations especially by a computer. [Reference: Concise Oxford English Dictionary, Indian Edition]
Ab Abdallh Muammad ibn Ms al-Khwrizm [780-850 AD], earlier transliterated as Algoritmi or Algaurizin, was a Persian mathematician, astronomer and geographer during the Abbasid Empire, a scholar in the House of Wisdom in Baghdad. In the twelfth century, Latin translations of his work on the Indian numerals introduced the decimal positional number system to the Western world. His Compendious Book on Calculation by Completion and Balancing presented the first systematic solution of linear and quadratic equations in Arabic. In Renaissance Europe, he was considered the original inventor of algebra, although it is now known that his work is based on older Indian or Greek sources. He revised Ptolemy's Geography and wrote on astronomy and astrology. Some words reflect the importance of al-Khwarizmi's contributions to mathematics. "Algebra" is derived from al-jabr, one of the two operations he used to solve quadratic equations. Algorism and algorithm stem from Algoritmi, the Latin form of his name. His name is also the origin of (Spanish) guarismo and of (Portuguese) algarismo, both meaning digit. [Source: http://en.wikipedia.org]
An Algorithm is a set of computational steps which converts the given input in desired output. Algorithm is a tool which is used to solve the computational problems. ALGORITHM + DATA STRUCTURE = PROGRAM Two ideas lie gleaming on the jewelers velvet. The first is the calculus; the second, the algorithm. The calculus and the rich body of mathematical analysis to which it give rise made modern science possible; but it has been the algorithmic that has made possible the modern world. [The Advent of Algorithm, 2000]
An algorithm is a statement of sequence of activities, which produces output from the given input.
This manuscript is personal notes of author notes of Author, which is collected by him from various Research Papers & books for his personal knowledge and concept building. So it should not be taken as reference in any mode or authentic source of information.
Page 2
PROBLEM
ALGORITHM
SEQUENCE OF ACTIVITIES/PROCESS
SOLUTION
ALGORITHM PROGRAM a The algorithm is a A program is an of complete description algorithm which one is of the process. is understood and to executed by a computer system. PROBLEM
LOGIC [Phase of development process for solution of given problem] ALGORITHMIC DESIGN [the Design Phase] PROGRAM DEVELOPMENT [IMPLEMENTATION PHASE] (Expression of ALGORITHM in any particular programming language.)
PROGRAM 1 IN JAVA
PROBLEM
ALGORITHM
PSEUDOCODE
PROGRAM 2
IN C++
PROGRAM 3
IN Python
This manuscript is personal notes of author notes of Author, which is collected by him from various Research Papers & books for his personal knowledge and concept building. So it should not be taken as reference in any mode or authentic source of information.
Page 3
V. VI.
Algorithmic Problems are:I. Sorting Problem II. Searching Problem III. Linear Programming Problem IV. Number Theory Problem
UNDERSTANDING THE PROBLEM ALGORITHM CODEING An efficient algorithm that solves a problem may be coded into an inefficient program. A correct algorithm may be encoded into incorrect problem.
Specification Methods Natural Language Pseudo Code Flow Chart
COMPUTING MODELS
A computing model is an abstract description of real computers. A computing model is used to design and analyze algorithms. The computing model specifies the basic operation of rules to compose any particular program. Complexity measure is a type of cost function, which is used for performance evaluation of algorithms. The complexity theory is used to articulate the amount of computational resources consumed to perform certain computational task.
This manuscript is personal notes of author notes of Author, which is collected by him from various Research Papers & books for his personal knowledge and concept building. So it should not be taken as reference in any mode or authentic source of information.
Page 4
With the help of computational model, sometimes it is possible to study the different dimensions of difficult computational problem. Types of computing Model:I. RAM [RANDOM ACCESS MACHINE] II. TURING MACHINE III. CIRCUIT MODEL IV. PRAM [PARALLEL RANDOM ACCESS MACHINE] RAM [RANDOM ACCESS MACHINE] - It is considered as a one processor computational abstract machine of computation for understand the ALGORITHM as a computer program. - In RAM Model, instructions are executed one after another with no concurrent operations. - RAM is an accumulator computer which instructions are not permitted to modify it. -
ANALYSIS OF ALGORITHM
The complexity of an ALGORITHM is the mathematical function f(x), which calculates the running time and/or storage space requirement of algorithm in term of the size n of input data. The storage space required by an algorithm is simply a multiple of data size n. The function f(n), which measures the time complexity of an algorithm is independent from the machine architecture or programming language. It focuses on the order of magnitude of the frequency of execution of statements. f(n)= O(g(n)) [O -> Big Oh ] If and only if |f(n)| c |g(x)| Where c & n is positive constants for all n n0 [
.
This manuscript is personal notes of author notes of Author, which is collected by him from various Research Papers & books for his personal knowledge and concept building. So it should not be taken as reference in any mode or authentic source of information.
Page 5