1 / 19

Problem Solving using the Science of Computing

Problem Solving using the Science of Computing. MSE 2400 EaLiCaRA Spring 2014 Dr. Tom Way. Problem Decomposition. Breaking a problem down into smaller and smaller steps until each step can be accomplished

schuyler
Télécharger la présentation

Problem Solving using the Science of Computing

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 usingtheScience of Computing MSE 2400 EaLiCaRA Spring 2014 Dr. Tom Way

  2. Problem Decomposition • Breaking a problem down into smaller and smaller steps until each step can be accomplished • Putting the solutions of each small step back together to solve the original problem MSE 2400 Evolution & Learning

  3. What is Programming • Program – a very specific set of instructions (or command lines) that make a computer do what you want it to do • Programming – the process of creating a program • the development of a solution to an identified problem, and setting up of a related series of instructions which, when directed through computer hardware, will produce the desired results MSE 2400 Evolution & Learning

  4. Steps in program development 1. Define the problem 2. Outline the solution 3. Develop the outline into an algorithm 4. Test the algorithm for correctness 5. Code the algorithm into a specific programming language 6. Run the program on the computer 7. Document and maintain the program MSE 2400 Evolution & Learning

  5. Define the Problem • Divide the problem into three components (called IPO): • Inputs – what do you have? • Outputs – what do you want to have? • Processing • how do you go from inputs to outputs? • A defining diagram is recommended MSE 2400 Evolution & Learning

  6. Outline the Solution • The major processing steps involved • The major subtasks (if any) • The major control structures (e.g. repetition loops) • The major variables and record structures • The mainline logic MSE 2400 Evolution & Learning

  7. Develop the Outline into an Algorithm • Algorithm is a set of precise steps that describe exactly the tasks to be performed, and the order in which they are to be carried out • Pseudocode (a form of structured English) is used to represent the solution algorithm MSE 2400 Evolution & Learning

  8. Test the Algorithm for Correctness • The main purpose of desk checking the algorithm is to identify major logic errors early, so that they may be easily corrected • Test data needs to be walked through each step in the algorithm, to check that the instructions described in the algorithm will actually do what they are supposed to MSE 2400 Evolution & Learning

  9. Code the Algorithm into a Specific Programming Language • Only after all design considerations have been met should you actually start to code the program into your chosen programming language (e.g. Python, Visual Basic, Java, C++) MSE 2400 Evolution & Learning

  10. Run the Program on the Computer • This step uses a program compiler and programmer-designed test data to machine test the code for syntax errors • Program complier translate high-level languages (e.g. VB) to low-level machine language before execution MSE 2400 Evolution & Learning

  11. Document and Maintain the Program • Not the last step in the program development process • An ongoing task from the initial definition of the problem to the final test result • Involves both external documentation (such as hierarchy charts) and internal documentation that may have been coded in the program MSE 2400 Evolution & Learning

  12. An Algorithm is . . . • instructions for solving a problem in a finite amount of time using a finite amount of data MSE 2400 Evolution & Learning

  13. A Program is . . . • an algorithm written for a computer that defines classes of objects and orchestrates their interactions to solve a problem • objects work together to create an application (or program) that solves a problem MSE 2400 Evolution & Learning

  14. Code is . . . • the product of translating an algorithm into a programming language • instructions for a computer that are written in a programming language MSE 2400 Evolution & Learning

  15. Programming Shortcut? PROBLEM-SOLVING PHASE Problem Algorithm Shortcut? Code TEST THINKING IMPLEMENTATION PHASE CODE MSE 2400 Evolution & Learning

  16. Problem Solving Techniques • ASK QUESTIONS -- about the data, the process, the output, error conditions • LOOK FOR FAMILIAR THINGS -- certain situations arise again and again • SOLVE BY ANALOGY -- it may give you a place to start • USE MEANS-ENDS ANALYSIS -- Determine the I/O and then work out the details MSE 2400 Evolution & Learning

  17. More Problem Solving Techniques • DIVIDE AND CONQUER -- break up large problems into manageable units • BUILDING-BLOCK APPPROACH -- can you solve small pieces of the problem? • MERGE SOLUTIONS -- instead of joining them end to end to avoid duplicate steps • OVERCOME MENTAL BLOCK -- by rewriting the problem in your own words MSE 2400 Evolution & Learning

  18. Sample Problem • A programmer wants to count the number of words in a text file MSE 2400 Evolution & Learning

  19. Count Words in File • Steps? MSE 2400 Evolution & Learning

More Related