1 / 45

Computer Science 101 Survey of Computer Science

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.

long
Download Presentation

Computer Science 101 Survey of Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Science 101Survey 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 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

  6. Algorithms on Youtube • Tying a Windsor Knot • Algorithm March with Prisoners • Sheldon’s Friendship Algorithm • Bubble Sort Algorithm • Quicksort Algorithm • Heap Sort Algorithm

  7. Sort Algorithm Demo • Use lab software for demo • Want to be president or work for Google?

  8. Adding m-digit numbers 478 a2 a1 a0 + 614 +b2 b1 b0 1092 c3 c2 c1 c0

  9. 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 + 1Step 7. End-of-loop Step 8. Set cm to carry Step 9. Print cm c(m-1) … c0 Step 10. Stop

  10. a2 a1 a0 b2 b1 b0 carry 4 7 8 6 1 4 c3 c2 c1 c0 i m 3 Output: 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

  11. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 c3 c2 c1 c0 i m 3 Output: 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 carry 0

  12. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 c3 c2 c1 c0 i m 3 0 Output: 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 carry 0

  13. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 c3 c2 c1 c0 i m 3 0 Output: 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 carry 0

  14. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 0 Output: 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 c3 c2 c1 c0 12 carry 0

  15. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 0 Output: 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 c3 c2 c1 c0 12 carry 0

  16. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 0 Output: 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 c3 c2 c1 c0 2 carry 0

  17. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 0 Output: 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 c3 c2 c1 c0 2 carry 1

  18. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 1 Output: 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 c3 c2 c1 c0 2 carry 1

  19. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 1 Output: 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 c3 c2 c1 c0 2 carry 1

  20. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 1 Output: 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 c3 c2 c1 c0 2 carry 1

  21. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 1 Output: 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 c3 c2 c1 c0 9 2 carry 1

  22. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 1 Output: 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 c3 c2 c1 c0 9 2 carry 1

  23. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 1 Output: 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 c3 c2 c1 c0 9 2 carry 1

  24. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 1 Output: 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 c3 c2 c1 c0 9 2 carry 0

  25. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 2 Output: 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 c3 c2 c1 c0 9 2 carry 0

  26. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 2 Output: 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 c3 c2 c1 c0 9 2 carry 0

  27. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 2 Output: 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 c3 c2 c1 c0 9 2 carry 0

  28. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 2 Output: 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 c3 c2 c1 c0 10 9 2 carry 0

  29. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 2 Output: 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 c3 c2 c1 c0 10 9 2 carry 0

  30. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 2 Output: 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 c3 c2 c1 c0 0 9 2 carry 0

  31. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 2 Output: 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 c3 c2 c1 c0 0 9 2 carry 1

  32. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 3 Output: 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 c3 c2 c1 c0 0 9 2 carry 1

  33. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 3 Output: 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 c3 c2 c1 c0 0 9 2 carry 1

  34. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 3 Output: 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 c3 c2 c1 c0 0 9 2 carry 1

  35. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 3 Output: 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 c3 c2 c1 c0 1 0 9 2 carry 1 1 0 9 2

  36. a2 a1 a0 b2 b1 b0 4 7 8 6 1 4 i m 3 3 Output: 1 0 9 2 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 c3 c2 c1 c0 1 0 9 2 carry 1

  37. Three major control constructs of algorithms(Execution flow of instructions) • 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. • Iterative: A set of statements is repeated over and over until some condition is met.

  38. 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.

  39. 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.

  40. Computer Science

  41. Algorithms – Formal, mathematical properties • How will algorithm perform on big data sets? • Which algorithm is better for the task? • Is the algorithm correct? • Is there a feasible algorithm for the task? • Is it possible to have algorithm for the task? • Do we need an approximation algorithm?

  42. Hardware Realizations • How do we build machines that can execute algorithms? • How do we store the data in hardware? • How do we store the instructions in hardware? • Smaller and faster? • Networks, wireless, etc. • Robots?

  43. Linguistic realizations • Language that machine understands • Language that is understandable to humans • Translation from one to the other • Languages that are good for certain kinds of tasks – scientific computing, business computing, artificial intelligence, etc.

  44. Applications • Intelligent robots • Web applications, E-commerce • Medical imaging • Social networking

  45. That's not a rattler, what kinda snake is that?

More Related