18C5T13 Lecture Notes - Lecture 5: Fibonacci Number, Insertion Sort, Natural Number

23 views17 pages

Document Summary

An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. In addition, all algorithms must satisfy the following criteria : If we trace out the instructions of an algorithm, then for all cases, the algorithm terminates after a finite number of steps. Every instruction must be very basic so that it can be carried out, in principle, by a person using only pencil and paper. It is not enough that each operation be definite as in criterion 3; it also must be feasible. Process of translating a problem into an algorithm. Sum of n elements by adding up elements one at a time. Sum=0; add a[1] to a[n] to sum one element at a time. return sum; Algorithm sum (a,n) sum:= 0. 0; for i:= 1 to n do sum:=sum+a[i]; Find the largest number among a list of elements by considering one element at a time.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents