Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Algorithmic Model. What is Computer Science What is Programming Algorithms –Definition –Properties of Good Algorithms –Describing Algorithms –Examples.

Similar presentations


Presentation on theme: "The Algorithmic Model. What is Computer Science What is Programming Algorithms –Definition –Properties of Good Algorithms –Describing Algorithms –Examples."— Presentation transcript:

1 The Algorithmic Model

2 What is Computer Science What is Programming Algorithms –Definition –Properties of Good Algorithms –Describing Algorithms –Examples –Components of Algorithms

3 What is Programming Programming requires two skills: –Algorithmic thinking –Knowledge of programming language syntax Learning language syntax is the easy part

4 How We Learn Computer Science We use pseudo-code to focus on learning algorithmic thinking From there, you can go anywhere! Not using a computer to compile and run your program forces you to mentally execute your program and debug it! Too many programmers try to program by brute force and twiddling

5 Algorithm Defined A set of logical steps to accomplish a task A “recipe of action” A way of describing behavior Algorithms contain: Data Instructions

6 Algorithms in Computing Input Data Algorithm Output Data

7 Chocolate Chip Cookies DATA (ingredients) 2 1/4 cups flour1 tsp salt 1 tsp baking soda2 eggs 3/4 cup brown sugar 1 tsp vanilla ext. 3/4 cup gran’d sugar 1 cup soft butter 12oz. semi-sweet chocolate chips INSTRUCTIONS (steps) Preheat oven to 375°. Combine flour, salt, baking soda, in bowl, set mixture aside. Combine sugars, butter, vanilla, beat until creamy. Add eggs and beat. Add dry mixture and mix well. Stir in chocolate chips Drop mixture by teaspoons onto ungreased cookie sheet Bake 8 to 10 minutes Algorithm “Recipe”

8 Abstraction 1.a general idea or term 2.an impractical idea; visionary and unrealistic 3.general characteristics apart from concrete realities, specific objects or actual instances 4.withdrawal 5.absent-mindedness; inattention 6.a work of art stressing formal relationships In Computer Science: Abstraction refers to the LOGICAL GROUPING of concepts or objects Define/implement the general idea, isolate the details (Random House Dictionary of the English Language)

9 Abstraction in Algorithms The Abstraction: Get to Clayton State IT Dept. from Atlanta One Implementation: begin get on I-75 heading south exit I-75 onto exit 234 turn left turn right on Clayton State Bvd. hit duck park in front of IT Dept. walk into front door end Other implementations of the same abstraction can be just as correct, better, or worse

10 What’s Wrong With This Algorithm? (From back of shampoo bottle) Directions: Wet Hair Apply a small amount of shampoo Lather Rinse Repeat

11 Properties of Good Algorithms Good algorithms are Precise Unambiguous Complete Correct Simple Contain levels of abstraction

12 Describing Algorithms Natural language (English) Pictures Pseudo-code or a specific programming language

13 1.Make a list of courses you want to register for, in order of priority 2.Start with empty schedule. Number of hours = 0. 3.Choose highest priority class on list. 4.If the chosen class is not full and its class time does not conflict with classes already scheduled, then register for the class: 4.a. Add the class to the schedule 4.b. Add the class hours to the number of hours scheduled 5.Cross that class off of your list. 6.Repeat steps 3 through 5 until the number of hours scheduled is >= 15, or until all classes have been crossed out. 7.Stop.

14 End Flowcharts Begin Make list of classes you want to take Num Hours = 0 Choose highest priority class on list Add the class to your schedule. Add class hours to Num Hours. Cross the class off your list. yes no Is this class full? Is there a time conflict? Num Hours >= 15? More classes on list? yes no

15 Components of Algorithms Any computing algorithm will have AT MOST five kinds of components: Data structures to hold data Instructions change data values Conditional expressions to make decisions Control structures to act on decisions Modules to make the algorithm manageable by abstraction, i.e., grouping related components

16 FIN


Download ppt "The Algorithmic Model. What is Computer Science What is Programming Algorithms –Definition –Properties of Good Algorithms –Describing Algorithms –Examples."

Similar presentations


Ads by Google