Download presentation
Presentation is loading. Please wait.
Published byEliza Stiller Modified over 9 years ago
2
Computer Science 101 Survey of Computer Science What is computer science?
3
Course Goals Provide broad view of the field of computer science for purposes of Provide broad view of the field of computer science for purposes of –general education. –further study of computer science.
4
Computer Science - NOT The study of computers. The study of computers. The study of computer programming. The study of computer programming. The study of computer applications. The study of computer applications. JUST
5
Algorithm (informal) Algorithm: A step by step procedure for solving a general class of problems. Algorithm: What Bill Clinton plays on his saxophone.
6
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
7
Algorithms on Youtube Tying a Windsor Knot Tying a Windsor Knot Tying a Windsor Knot Tying a Windsor Knot Algorithm March with Prisoners Algorithm March with Prisoners Algorithm March with Prisoners Algorithm March with Prisoners Sheldon’s Friendship Algorithm Sheldon’s Friendship Algorithm Sheldon’s Friendship Algorithm Sheldon’s Friendship Algorithm Bubble Sort Algorithm Bubble Sort Algorithm Bubble Sort Algorithm Bubble Sort Algorithm Quicksort Algorithm Quicksort Algorithm Quicksort Algorithm Quicksort Algorithm Heap Sort Algorithm Heap Sort Algorithm Heap Sort Algorithm Heap Sort Algorithm
8
Sort Algorithm Demo Use lab software for demo Use lab software for demo Want to be president or work for Google? Want to be president or work for Google? Want to be president or work for Google? Want to be president or work for Google?
9
Adding m-digit numbers 478a2 a1 a0 + 614 +b2 b1 b0 1092 c3 c2 c1 c0
10
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
11
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 carry i Output: 3 m
12
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 carry 0 i Output: 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 3 m
13
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 carry 0 i 0 Output: 3 m 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
14
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 carry 0 i 0 Output: 3 m 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
15
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 12 carry 0 i 0 Output: 3 m 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
16
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 12 carry 0 i 0 Output: 3 m 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
17
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 2 carry 0 i 0 Output: 3 m 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
18
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 2 carry 1 i 0 Output: 3 m 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
19
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 2 carry 1 i 1 Output: 3 m 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
20
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 2 carry 1 i 1 Output: 3 m 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
21
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 2 carry 1 i 1 Output: 3 m 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
22
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 9 2 carry 1 i 1 Output: 3 m 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
23
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 9 2 carry 1 i 1 Output: 3 m 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
24
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 9 2 carry 1 i 1 Output: 3 m 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
25
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 9 2 carry 0 i 1 Output: 3 m 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
26
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 9 2 carry 0 i 2 Output: 3 m 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
27
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 9 2 carry 0 i 2 Output: 3 m 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
28
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 9 2 carry 0 i 2 Output: 3 m 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
29
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 10 9 2 carry 0 i 2 Output: 3 m 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
30
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 10 9 2 carry 0 i 2 Output: 3 m 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
31
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 0 9 2 carry 0 i 2 Output: 3 m 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
32
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 0 9 2 carry 1 i 2 Output: 3 m 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
33
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 0 9 2 carry 1 i 3 Output: 3 m 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
34
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 0 9 2 carry 1 i 3 Output: 3 m 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
35
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 0 9 2 carry 1 i 3 Output: 3 m 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
36
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 1 0 9 2 carry 1 1092 i 3 Output: 3 m 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
37
Adding m-digit numbers a2 a1 a0 4 7 8 b2 b1 b0 6 1 4 c3 c2 c1 c0 1 0 9 2 carry 1 i 3 Output:1092 3 m 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
38
Three major control constructs of algorithms (Execution flow of instructions) Sequential: Simply do steps one after the other in order they are listed. Sequential: Simply do steps one after the other in order they are listed. Conditional: Decide which statement to do next based on some true/false test. Conditional: Decide which statement to do next based on some true/false test. Iterative: A set of statements is repeated over and over until some condition is met. Iterative: A set of statements is repeated over and over until some condition is met.
39
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.
40
Algorithm Well-ordered: There is a clear order in which to do the operations. Well-ordered: There is a clear order in which to do the operations. Unambiguous: Each operation is clearly understood by all intended computing agents. Unambiguous: Each operation is clearly understood by all intended computing agents. Effectively computable: The computing agent has ability to carry out each operation. 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. Finite time: Each operation takes finite time and there will be a finite number of steps.
41
Computer Science
42
Algorithms – Formal, mathematical properties How will algorithm perform on big data sets? How will algorithm perform on big data sets? Which algorithm is better for the task? Which algorithm is better for the task? Is the algorithm correct? Is the algorithm correct? Is there a feasible algorithm for the task? Is there a feasible algorithm for the task? Is it possible to have algorithm for the task? Is it possible to have algorithm for the task? Do we need an approximation algorithm? Do we need an approximation algorithm?
43
Hardware Realizations How do we build machines that can execute algorithms? How do we build machines that can execute algorithms? How do we store the data in hardware? How do we store the data in hardware? How do we store the instructions in hardware? How do we store the instructions in hardware? Smaller and faster? Smaller and faster? Networks, wireless, etc. Networks, wireless, etc. Robots? Robots?
44
Linguistic realizations Language that machine understands Language that machine understands Language that is understandable to humans Language that is understandable to humans Translation from one to the other Translation from one to the other Languages that are good for certain kinds of tasks – scientific computing, business computing, artificial intelligence, etc. Languages that are good for certain kinds of tasks – scientific computing, business computing, artificial intelligence, etc.
45
Applications Intelligent robots Intelligent robots Web applications, E-commerce Web applications, E-commerce Medical imaging Medical imaging Social networking Social networking
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.