Download presentation
Presentation is loading. Please wait.
Published byΘυώνη Μελετόπουλος Modified over 5 years ago
1
Computer Science 101 Survey of Computer Science
What is computer science?
2
Course Goals Provide broad view of the field of computer science for purposes of general education. further study of computer science.
3
Computer Science - NOT JUST The study of computers.
The study of computer programming. The study of computer applications.
4
Algorithm (informal) Algorithm: A step by step procedure for solving a general class of problems. Algorithm: What Bill Clinton plays on his saxophone.
5
Programming VCR Step 1. If the clock and calendar are not correctly set, then go to page 9 of the owner's manual and follow instructions there. Step 2. Place a blank tape in the VCR tape slot. Step 3. Repeat steps 4-7 for each program, up to 10 times Step Enter the channel number and press CHAN Step Enter time to start and press TIME-START Step Enter time to stop and press TIME-FINISH Step If no more programs, press END-PROG Step 8. Press TIMER
6
Adding m-digit numbers
478 a2 a1 a0 b2 b1 b0 c3 c2 c1 c0
7
Adding m-digit numbers
Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i < m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm c(m-1) … c0 Step 10. Stop
8
Adding m-digit numbers
Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop a2 a1 a0 b2 b1 b0 c3 c2 c1 c0 i Output: 3 m carry
9
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i Output: carry
10
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i Output: carry
11
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i Output: carry
12
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 12 3 m i Output: carry
13
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 12 3 m i Output: carry
14
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 2 3 m i Output: carry
15
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 2 3 m i Output: carry 1
16
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 2 3 m i 1 Output: carry 1
17
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 2 3 m i 1 Output: carry 1
18
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 2 3 m i 1 Output: carry 1
19
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 9 2 3 m i 1 Output: carry 1
20
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 9 2 3 m i 1 Output: carry 1
21
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 9 2 3 m i 1 Output: carry 1
22
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 9 2 3 m i 1 Output: carry
23
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 9 2 3 m i 2 Output: carry
24
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 9 2 3 m i 2 Output: carry
25
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 9 2 3 m i 2 Output: carry
26
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i 2 Output: carry
27
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i 2 Output: carry
28
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i 2 Output: carry
29
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i 2 Output: carry 1
30
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i 3 Output: carry 1
31
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i 3 Output: carry 1
32
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i 3 Output: carry 1
33
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 3 m i 3 Output: carry 1 1 9 2
34
Adding m-digit numbers
a2 a1 a0 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step Set ci to ai + bi + carry Step If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step Set i to i + 1 Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm … c0 Step 10. Stop b2 b1 b0 c3 c2 c1 c0 i 3 Output: 1 9 2 3 m carry 1
35
Algorithm (formal) A well-ordered collection of unambiguous and effectively computable operations that when executed produces a result and halts in a finite amount of time.
36
Algorithm Well-ordered: There is a clear order in which to do the operations. Unambiguous: Each operation is clearly understood by all intended computing agents. Effectively computable: The computing agent has ability to carry out each operation. Finite time: Each operation takes finite time and there will be a finite number of steps.
37
Computer Science
38
They might look like cowboys
but they're not cowboys!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.