Computer Science 101 Survey of Computer Science What is computer science?
Course Goals Provide broad view of the field of computer science for purposes of general education. further study of computer science.
Computer Science - NOT JUST The study of computers. The study of computer programming. The study of computer applications.
Algorithm (informal) Algorithm: A step by step procedure for solving a general class of problems. Algorithm: What Bill Clinton plays on his saxophone.
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 4. Enter the channel number and press CHAN Step 5. Enter time to start and press TIME-START Step 6. Enter time to stop and press TIME-FINISH Step 7. If no more programs, press END-PROG Step 8. Press TIMER
Adding m-digit numbers 478 a2 a1 a0 + 614 +b2 b1 b0 1092 c3 c2 c1 c0
Adding m-digit numbers Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i < m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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
Adding m-digit numbers Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 i Output: 3 m carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 3 m i Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 3 m i Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 3 m i Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 12 3 m i Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 12 3 m i Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 2 3 m i Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 2 3 m i Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 2 3 m i 1 Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 2 3 m i 1 Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 2 3 m i 1 Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 9 2 3 m i 1 Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 9 2 3 m i 1 Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 9 2 3 m i 1 Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 9 2 3 m i 1 Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 9 2 3 m i 2 Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 9 2 3 m i 2 Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 9 2 3 m i 2 Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 10 9 2 3 m i 2 Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 10 9 2 3 m i 2 Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 0 9 2 3 m i 2 Output: carry
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 0 9 2 3 m i 2 Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 0 9 2 3 m i 3 Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 0 9 2 3 m i 3 Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 0 9 2 3 m i 3 Output: carry 1
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 1 0 9 2 3 m i 3 Output: carry 1 1 9 2
Adding m-digit numbers a2 a1 a0 4 7 8 Step 1. Set carry to 0 Step 2. Set i to 0 Step 3. While i<m do Step 4. Set ci to ai + bi + carry Step 5. If ci ≥ 10 then Set ci to ci - 10 Set carry to 1 else Set carry to 0 Step 6. 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 6 1 4 c3 c2 c1 c0 1 0 9 2 i 3 Output: 1 9 2 3 m carry 1
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.
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.
Computer Science
They might look like cowboys but they're not cowboys!