Lecture 1
Grade school algorithms
- Sept. 8, 2017
1
Lecture 1 Grade school algorithms Sept. 8, 2017 1 What is an - - PowerPoint PPT Presentation
Lecture 1 Grade school algorithms Sept. 8, 2017 1 What is an algorithm? An algorithm is a sequence of instructions or rules or operations for manipulating data to produce some result. Think of an algorithm as a recipe. In CS, the recipe
1
2
3
4
5
6
7
8
compute single digit sum a[i] + b[i] and add the carry value from previous column determine the result r[i] for that column
9
determine the carry value for the next column
(Hindu-Arabic system invented ~2000 years ago)
10
11
12
13
1
14
15
a is the “multiplicand” b is the “multiplier”
16
17
18
“multiplicand” “multiplier”
19
// column // row
20
21
22
23
24
25
26
27
28
N N^2 N 1 N N^2 N
30
31
32