Algorithm: Is A Finite Set of Precise Instructions For Performing A Computation or For Solving A Problem
Algorithm: Is A Finite Set of Precise Instructions For Performing A Computation or For Solving A Problem
Is a finite set of precise instructions for performing a computation or for solving a problem.
Abu Abdallah Muammad ibn Ms al-Khwrizm) the famous mathematician, astronomer and geographer, a scholar in the House of Baghdad.
He wrote a treatise in 825 AD, On Calculation with Hindu Numerals. It was translated into Latin in the 12th century as Algoritmi on the numbers of the Indians, where Algoritmi was the translators rendition of the authors name; but people misunderstanding the title treated Algoritmi as a Latin plural and this led to the word algorithm (Latin algorismus) coming to mean calculation method. The intrusive th is most likely due to a false cognate with the Greek (arithmos) meaning numbers
Notion of Algorithm
Problem to be solved
INPUT
Computer
OUTPUT
The basic idea behind algorithms--and really, programs in general--is to decide what you want to accomplish and then keep breaking it into steps. For example, say you want to play tennis. You might have to do the following:
1. Call some friends and invite them to play. 2. Gather your stuff. 3. Drive to the tennis court.
1. Call a friend and invite them to play. If the friend says no, repeat this step with another friend. If the friend says yes, go to Step #2. 2. Decide a time and location to play. 3. Locate your tennis racket. 4. Put your tennis racket in your car. 5. Ten minutes before [time] occurs, drive to [location].
Describe an algorithm for finding the maximum (largest) value in a finite sequence of integers. Solution: using English Language 1. Set the temporary maximum equal to the first integer in the sequence. (The temporary maximum will be the largest integer examined at any stage of the procedure.) 2. Compare the next integer in the sequence to the temporary maximum equal to this integer. 3. Repeat the previous step if there are more integers in the sequence. 4. Stop when there are no integers left in the sequence. The temporary maximum at this point is the largest integer in he sequence.
Solution: using Programming Language Procedure max(aa,,a: integers) max:= a for i:=2 to n if max< a then max:= a