1 / 17

Problem Solving Methods

Problem Solving Methods. Learning Objectives. Define an algorithm Know what is meant by "decomposition" of a problem Learn how to write algorithms using flowcharts and pseudocodes Know what is meant by "top-down" design method. General Problem Solving Method Define and understand problem

taipa
Télécharger la présentation

Problem Solving Methods

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Problem Solving Methods

  2. Learning Objectives • Define an algorithm • Know what is meant by "decomposition" of a problem • Learn how to write algorithms using flowcharts and pseudocodes • Know what is meant by "top-down" design method

  3. General Problem Solving Method Define and understand problem Sketch the problem Gather information Generate and evaluate potential solutions Use applicable theories and assumptions Refine and implement solution Verify and test solution Problem Solving Process

  4. Exercise • Turn off your monitors. • don’t turn on until instructed • As an INDIVIDUAL, take 2 MINUTES to write your definition of an algorithm • As a TEAM, take 2 minutes to combine your answers

  5. Algorithms • Algorithm: “a step-by-step procedure for solving a problem or accomplishing an end” (Webster) • Algorithms can be described by • Pseudocode • Flowcharts

  6. Pseudocode (you can turn on your monitors now) • English-like description of each step of algorithm • Not computer code • Example - take out trash barrels while there are more barrels take barrel to street return to garage end

  7. Process Step Input/Output Start/Stop Process Flow Branch Test Flowcharts • Graphical description of algorithm • Standard symbols used for specific operations

  8. Flowchart Example Begin Define the problem Read input Ask for more input yes Can I solve this? Can I solve this? What do I need to know? no yes no Solve the problem Output results End

  9. Top Down Design • State problem clearly • Sketch problem • Describe input/output (I/O) • Work problem by hand • Algorithm: pseudocode or flowchart • Decomposition - break problem into steps • Stepwise refinement - solve each step • Test the algorithm/check your work!!

  10. Example (Team exercise, 15 min) • State problem clearly: • Given ax2 + bx + c = 0, find x. • Describe I/O: • Input: a, b, c • Output: x

  11. Example (cont.) • Hand example: • a=1, b=4, c=4 • equation? (See Chapter 6, Mathematics Supplement) • x=?

  12. Example (cont.) • Algorithm development • write an algorithm in pseudocode to take any set of coefficients (i.e., a, b, c) and give the value of x for each set • Test your algorithm • a,b,c = 1,4,4 • a,b,c = 1,1,-6 • a,b,c = 1,0,1 • other good test cases?

  13. Example (cont.) • CHECK YOUR WORK!! • DO YOUR RESULTS MAKE PHYSICAL SENSE?!?

  14. Getting It Right • The problem solving process may be an iterative process. • If at first you don’t succeed (i.e., if the algorithm test fails), try again… • The more thorough you are at each step of the problem solving process, the more likely you are to get it right the first time!!

  15. VCR Problem Revisited • You own a VCR that has two recording and playback speeds: 1) standard play (SP) and 2) extended play (EP). The speed in the EP mode is 1/3 the speed in the SP mode. At the SP setting, the video tapes you own can be used to record exactly 120 minutes of video. Develop an algorithm that specifies how long to record at SP speed, and how long to record at EP speed, given a program of known length.

  16. Exercise • As a TEAM, take 15 MINUTES to solve the VCR problem by developing a flowchart algorithm. • The flowchart algorithm will be handed in.

  17. Think-Pair-Share • In the next 1 minute as an individual... • Identify three topics that we have covered so far (including today) that are still unclear • Now take 2 minutes to merge your list with the person sitting next to you AND add 1 new item to the list. • In the next 5 minutes, share the results with the other half of your team, delete questions that you can answer for each other, AND prioritize the remaining questions in your list.

More Related