45
Computer Science Computer Science 101 101 Survey of Computer Survey of Computer Science Science What is computer science? What is computer science?

Computer Science 101 Survey of Computer Science

  • Upload
    long

  • View
    129

  • Download
    3

Embed Size (px)

DESCRIPTION

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. - PowerPoint PPT Presentation

Citation preview

Page 1: Computer Science 101 Survey of Computer Science

Computer Science Computer Science 101101

Survey of Computer Survey of Computer ScienceScience

What is computer science?What is computer science?

Page 2: Computer Science 101 Survey of Computer Science

Course GoalsCourse Goals

Provide broad view of the field of Provide broad view of the field of computer science for purposes of computer science for purposes of

– general education. general education.

– further study of computer science.further study of computer science.

Page 3: Computer Science 101 Survey of Computer Science

Computer Science - NOTComputer Science - NOT

The study of computers.The study of computers.

The study of computer The study of computer programming.programming.

The study of computer applications.The study of computer applications.

JUST

Page 4: Computer Science 101 Survey of Computer Science

Algorithm Algorithm (informal)(informal)

Algorithm:

A step by step procedure for solving a generalclass of problems.

Algorithm:

What Bill Clinton plays on his saxophone.

Page 5: Computer Science 101 Survey of Computer Science

Programming VCRProgramming 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 timesStep 4. Enter the channel number and press CHANStep 5. Enter time to start and press TIME-STARTStep 6. Enter time to stop and press TIME-FINISHStep 7. If no more programs, press END-PROGStep 8. Press TIMER

Page 6: Computer Science 101 Survey of Computer Science

Algorithms on YoutubeAlgorithms on Youtube Tying a Windsor KnotTying a Windsor Knot

Algorithm March with PrisonersAlgorithm March with Prisoners

Sheldon’s Friendship AlgorithmSheldon’s Friendship Algorithm

Bubble Sort AlgorithmBubble Sort Algorithm

Quicksort AlgorithmQuicksort Algorithm

Heap Sort AlgorithmHeap Sort Algorithm

Page 7: Computer Science 101 Survey of Computer Science

Sort Algorithm DemoSort Algorithm Demo

Use lab software for demoUse lab software for demo

Want to be president or work for Want to be president or work for Google?Google?

Page 8: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbers

478 a2 a1 a0 + 614 +b2 b1 b0

1092 c3 c2 c1 c0

Page 9: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbers

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i < m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm c(m-1) … c0Step 10. Stop

Page 10: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersStep 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

a2 a1 a0 4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0

carry

i

Output:

3m

Page 11: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0

carry 0

i

Output:

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

3m

Page 12: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0

carry 0

i

0

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 13: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0

carry 0

i

0

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 14: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 12

carry 0

i

0

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 15: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 12

carry 0

i

0

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 16: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 2

carry 0

i

0

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 17: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 2

carry 1

i

0

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 18: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 2

carry 1

i

1

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 19: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 2

carry 1

i

1

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 20: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 2

carry 1

i

1

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 21: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 9 2

carry 1

i

1

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 22: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 9 2

carry 1

i

1

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 23: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 9 2

carry 1

i

1

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 24: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 9 2

carry 0

i

1

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 25: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 9 2

carry 0

i

2

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 26: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 9 2

carry 0

i

2

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 27: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 9 2

carry 0

i

2

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 28: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 10 9 2

carry 0

i

2

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 29: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 10 9 2

carry 0

i

2

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 30: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 0 9 2

carry 0

i

2

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 31: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 0 9 2

carry 1

i

2

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 32: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 0 9 2

carry 1

i

3

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 33: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 0 9 2

carry 1

i

3

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 34: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 0 9 2

carry 1

i

3

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 35: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 1 0 9 2

carry 1

1 0 9 2

i

3

Output:

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 36: Computer Science 101 Survey of Computer Science

Adding m-digit numbersAdding m-digit numbersa2 a1 a0

4 7 8

b2 b1 b0 6 1 4

c3 c2 c1 c0 1 0 9 2

carry 1

i

3

Output: 1 0 9 2

3m

Step 1. Set carry to 0Step 2. Set i to 0Step 3. While i<m doStep 4. Set ci to ai + bi + carryStep 5. If ci ≥ 10 then

Set ci to ci - 10Set carry to 1

else Set carry to 0

Step 6. Set i to i + 1Step 7. End-of-loopStep 8. Set cm to carryStep 9. Print cm … c0Step 10. Stop

Page 37: Computer Science 101 Survey of Computer Science

Three major control Three major control constructs constructs

of algorithmsof algorithms(Execution flow of instructions)(Execution flow of instructions)

Sequential:Sequential: Simply do steps one after Simply do steps one after the other in order they are listed.the other in order they are listed.

Conditional:Conditional: Decide which statement Decide which statement to do next based on some true/false to do next based on some true/false test.test.

Iterative:Iterative: A set of statements is A set of statements is repeated over and over until some repeated over and over until some condition is met.condition is met.

Page 38: Computer Science 101 Survey of Computer Science

Algorithm Algorithm (formal)(formal)

A well-ordered collection of unambiguous A well-ordered collection of unambiguous and effectively computable operations and effectively computable operations that when executed produces a result that when executed produces a result and halts in a finite amount of time.and halts in a finite amount of time.

Page 39: Computer Science 101 Survey of Computer Science

AlgorithmAlgorithm Well-orderedWell-ordered: There is a clear order : There is a clear order

in which to do the operations.in which to do the operations. UnambiguousUnambiguous: Each operation is : Each operation is

clearly understood by all intended clearly understood by all intended computing agents.computing agents.

Effectively computableEffectively computable: The : The computing agent has ability to carry computing agent has ability to carry out each operation.out each operation.

Finite timeFinite time: Each operation takes : Each operation takes finite time and there will be a finite finite time and there will be a finite number of steps.number of steps.

Page 40: Computer Science 101 Survey of Computer Science

Computer ScienceComputer Science

F orm a l a ndm a th e m a tica l

p rope r ties

H ard w a rere a liza tions

L ing u is ticre a liza tions

A p p lica tio ns

A lgo ri thm s

Page 41: Computer Science 101 Survey of Computer Science

Algorithms – Formal, mathematical Algorithms – Formal, mathematical propertiesproperties

How will algorithm perform on big data How will algorithm perform on big data sets?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 Is it possible to have algorithm for the

task?task? Do we need an approximation algorithm?Do we need an approximation algorithm?

Page 42: Computer Science 101 Survey of Computer Science

Hardware RealizationsHardware Realizations

How do we build machines that can How do we build machines that can execute algorithms?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 How do we store the instructions in

hardware?hardware? Smaller and faster?Smaller and faster? Networks, wireless, etc.Networks, wireless, etc. Robots?Robots?

Page 43: Computer Science 101 Survey of Computer Science

Linguistic realizationsLinguistic realizations

Language that machine understandsLanguage that machine understands Language that is understandable to Language that is understandable to

humanshumans Translation from one to the otherTranslation from one to the other Languages that are good for certain Languages that are good for certain

kinds of tasks – scientific computing, kinds of tasks – scientific computing, business computing, artificial business computing, artificial intelligence, etc.intelligence, etc.

Page 44: Computer Science 101 Survey of Computer Science

ApplicationsApplications

Intelligent robotsIntelligent robots

Web applications, E-commerceWeb applications, E-commerce

Medical imagingMedical imaging

Social networkingSocial networking

Page 45: Computer Science 101 Survey of Computer Science