/
Programming Programming

Programming - PowerPoint Presentation

ellena-manuel
ellena-manuel . @ellena-manuel
Follow
378 views
Uploaded On 2016-05-13

Programming - PPT Presentation

Practicum Day 1 Introduction and Problem Solving Aaron Tan NUS School of Computing 2 Contents Why are You here What is Computer Science What is Problem Solving What is Algorithmic Problem Solving ID: 318558

practicum programming december 2009 programming practicum 2009 december problem solving board figure exercise computer show science components computing process chain analysisdesignimplementationtesting removed

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Programming" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Programming Practicum

Day 1: Introduction and Problem Solving

Aaron Tan

NUS School of ComputingSlide2

2

Contents

Why are You here?

What is Computer Science?

What is Problem Solving?What is Algorithmic Problem Solving?

[Programming Practicum, December 2009]Slide3

3

Why are You here?

What are your objectives?

What is your level of programming skills?

What you think programming is about?

3

[Programming Practicum, December 2009]Slide4

4

What is Computer Science? (1/2)

Computing Curricula 2001 (Computer Science) Report identifies 14 knowledge focus groups

Applications within and outside of Computing

Discrete Structures (DS)

Programming Fundamentals (PF)

Algorithms and Complexity (AL)

Architecture and Organization (AR)

Operating Systems (OS)

Net-Centric Computing (NC)

Programming Languages (PL)

Human-Computer Interaction (HC) Graphics and Visual Computing (GV) Intelligent Systems (IS) Information Management (IM) Social and Professional Issues (SP) Software Engineering (SE) Computational Science (CN)

4

[Programming Practicum, December 2009]Slide5

5

What is Computer Science? (2/2)

Some recommended readings

How to Think about Algorithms

Jeff Edmonds, Cambridge, 2008

Algorithmics

: The Spirit of Computing

David

Harel

, 2

nd

ed

, Addison-Wesley (3

rd ed. available)Introduction to AlgorithmsT.H. Cormen, C.E. Leiserson, R.L. Rivest, C. Stein, 2

nd ed, MIT PressThe New Turing Omnibus: 66 Excursions in Computer ScienceA.K. Dewdney, Holt

5

[Programming Practicum, December 2009]Slide6

6

[Programming Practicum, December 2009]

Problem Solving Process (1/5)

Analysis

Design

Implementation

Testing

Determine the inputs, outputs, and other components of the problem.

Description should be sufficiently specific to allow you to solve the problem.Slide7

7

Problem Solving Process (2/5)

Analysis

Design

ImplementationTesting

Describe the components and associated processes for solving the problem.

Straightforward and flexible

Method – process

Object – component and associated methods

[Programming Practicum, December 2009]Slide8

8

Problem Solving Process (3/5)

Analysis

Design

ImplementationTesting

Develop solutions for the components and use those components to produce an overall solution.

Straightforward and flexible

[Programming Practicum, December 2009]Slide9

9

Problem Solving Process (4/5)

Analysis

Design

ImplementationTesting

Test the components individually and collectively.

[Programming Practicum, December 2009]Slide10

10

Problem Solving Process (5/5)

[Programming Practicum, December 2009]Slide11

11

Problem Solving Exercises

The exercises in the next few slides are of varied nature, chosen to illustrate the extent of general problem solving.

Different kinds of questions require different domain knowledge and strategies.

Apply your problem solving skills and creativity here!

[Programming Practicum, December 2009]Slide12

12

Exercise #1: Bear

A bear, starting from the point

P

, walked one mile due south. Then he changed direction and walked one mile due east. Then he turned again to the left and walked one mile due north, and arrived at the point P he started from. What was the colour of the bear?

[Programming Practicum, December 2009]Slide13

13

Exercise #2: Silver chain

A traveller arrives at an inn and intends to stay for a week. He has no money but only a silver chain consisting of 7 links. He uses one link to pay for each day spent at the inn, but the innkeeper agrees to accept no more than one broken link. How should the traveller cut up the chain in order to settle accounts with the innkeeper on a daily basis?

[Programming Practicum, December 2009]Slide14

14

Exercise #3: Glasses of milk

Six glasses are in a row, the first three full of milk, the second three empty. By moving only one glass, can you arrange them so that empty and full glasses alternate?

[Programming Practicum, December 2009]Slide15

15

Exercise #4: Puzzles

What am I?

You can catch me but not throw me.

I go all around the world but stay in the corner.You throw away the outside and eat the inside. Then you eat the outside and throw away the inside.

[Programming Practicum, December 2009]Slide16

16

Exercise #5: Mad scientist

A mad scientist wishes to make a chain out of plutonium and lead pieces. There is a problem, however. If the scientist places two pieces of plutonium next to each other,

BOOM!!!

The question is, in how many ways can the scientist safely construct a chain of length n

?

[Programming Practicum, December 2009]Slide17

17

Exercise #6: Dominoes

Figure 1 below shows a domino and Figure 2 shows a 4

4 board with the two squares at opposite corners removed. How do you show that it is not possible to cover this board completely with dominoes? All dominoes should lay flat on the board, without overlapping one another, and should not cover area outside the board.

Figure 1. A domino.

Figure 2. A 4

4 board with 2 corner squares removed.

General case:

How do you show the same for an

n

n

board with the two squares at opposite corners removed, where

n

is even?

Special case:

How do you show the same for an

n

n

board with the two squares at opposite corners removed, where

n

is odd?

[Programming Practicum, December 2009]Slide18

18

Exercise #7: Triominoes

Figure 3 below shows a

triomino

and Figure 4 shows a 4  4 board with a defect (hole) in one square.

How do you show that the board can be covered with

triominoes

?

General case:

How do you show that a 2

n

2

n board (where n  1) with a hole in one square (anywhere on the board) can be covered with triominoes?Figure 3. A triomino.

Figure 4. A 44 board with a hole.

[Programming Practicum, December 2009]Slide19

19

Algorithmic Problem Solving

An

algorithm

is a well-defined computational procedure consisting of a set of instructions, that takes some value or set of values, as

input

, and produces some value or set of values, as

output

.

Algorithm

Input

Output

[Programming Practicum, December 2009]Slide20

20

Task 3: NE-Paths

To find the number of north-east paths between any two points.

North-east (NE) path: you may only move northward or eastward.

How many NE-paths between A and C?

C

A

A

A

A

20

[Programming Practicum, December 2009]Slide21

21

THE END