welcome cosc 145: algorithmic thinking dr. donald simon [email protected] [email protected]

11
Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon [email protected] [email protected]

Upload: shauna-pierce

Post on 19-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Welcome

COSC 145: Algorithmic Thinking

Dr. Donald Simon

[email protected]

[email protected]

Page 2: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Algorithms

From Wikipedia.org: Effective method for solving a problem Expressed as a finite sequence of steps List of well-defined instructions for completing a

task Describes a computation that proceeds through a

well-defined series of successive states Terminates in a final ending state

Page 3: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Enchiladas

• Preheat oven to 350° F.• In a heavy saucepan

– Heat 2 tablespoons of olive oil.– Saute

½ cup chopped onion

1 minced garlic clove

until golden– Add

1 tablespoon chili powder

1 cup tomato puree

½ cup chicken stock

Page 4: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Enchiladas (cont'd)

– Season with

Salt and pepper

1 teaspoon cumin• Spread sauce over tortillas• Fill centers with equal quantities of

Chopped raw onion

Chopped mozzarella cheese• Roll tortillas• Place in ovenproof dish• Pour more sauce over tops• Sprinkle with chopped mozzarella cheese• Heat thoroughly in oven about 15 minutes

Page 5: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Shampoo Instructions

• Apply shampoo to wet hair• Lather• Rinse• Repeat

Page 6: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Exercise 1

Computers are very good at following directions to

the letter. How are people?

Shake hands with everybody in the room and tell

them your name.

Question 1: How many hands did you shake?

Question 2: How many total handshakes were there?

Page 7: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Exercise 2

Stand in line by order by height.

Question: How did you determine where to stand?

Page 8: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Exercise 3

Stand in line by order of birthday.

Question: How did you determine where to stand?

Page 9: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Exercise 4

Sort one suit of cards into numerical order. Assume

that aces are high.

Question: Can you systematically describe how you

sorted the cards?

Page 10: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Exercise 5

Break up into pairs Person 1 in each pair will have a suit of cards Person 1 should scramble the cards Only Person 1 may look at the faces of the cards Person 2 will lead Person 1 in sorting the cards:

Person 2 may not touch or look at the faces of the cards Person 2 may ask Person 1 to compare two cards and state which

is smaller/larger Person 2 may ask Person 1 to move a card to a different place

Page 11: Welcome COSC 145: Algorithmic Thinking Dr. Donald Simon simon@mathcs.duq.edu simond@duq.edu

Exercise 5 (cont'd)

Question: Can Person 1 systematically describe how

to sort the cards, i.e., give an algorithm for sorting

a suit of cards?