This preview shows pages 1–13. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Algorithms And Flowcharts The plan Why We Need Them What They Are How to Make an Algorithm Testing Your Idea What is an algorithm, anyway? An algorithm is any welldefined computational procedure that takes some value or set of values as input and produces some value or set of values as output. Probably a "bad" algorithm From "How to Solve it" by George Polya How to make an Algorithm First, you have to understand the problem . After understanding, then make a plan . Carry out the plan . Look back on your work. How could it be better? Understand the problem What are you asked to find or show? Can you restate the problem in your own words? Can you think of a picture or a diagram that might help you understand the problem? Is there enough information to enable you to find a solution? Do you understand all the words used in stating the problem? Do you need to ask a question to get the answer? Make a plan Guess and check Looking for a pattern Solving a simpler problem Drawing a picture Carry out a plan You need care and patience. Persist with the plan that you have chosen. If it continues not to work discard it and choose another. Look back on your work. How could it be better? Reflecting on your successes and Example Cooking instructions for popular Macaroni and Cheese Classic Prep: 6 cups water, 4 Tbsp. Margarine, cup 2% milk Cooking Instructions: BOIL water. Stir in Macaroni; Cook 78 minutes or until tender stirring occasionally. DRAIN. DO NOT RINSE. Return to pan. ADD margarine, milk, and Cheese Sauce Mix. Mix well. Example: Find the oldest person in a room. A Balanced Introduction to Computer Science, 3rd ed. By David Reed. INPUT PROCESSINGOUTPUT Example: Find the oldest person in a room. A Balanced Introduction to Computer Science, 3rd ed. By David Reed. INPUT PROCESSING OUTPUT Algorithm: Add the following test scores: 90,78,87,67 Start sum = 0 Input the first testscore Add first testscore to sumsum = 90 Input the second testscore Add to sum sum = 168 Input the third testscore Add to sum sum = 255 Input the fourth testscore Example...
View
Full
Document
This note was uploaded on 11/29/2011 for the course INTRO TO C 110 taught by Professor Frantrees during the Fall '11 term at Rutgers.
 Fall '11
 FranTrees

Click to edit the document details