1 / 29

Problem Solving and Programming – Problem Solving

Dr Scott Turner. Problem Solving and Programming – Problem Solving. Why do you needed to develop problem solving skills?. One definition of programming is it is applied problem solving You have a problem (E.g Need a program to calculate the area of the circle). What needs to be done?

rosesims
Télécharger la présentation

Problem Solving and Programming – Problem Solving

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. Dr Scott Turner Problem Solving and Programming – Problem Solving

  2. Why do you needed to develop problem solving skills? • One definition of programming is it is applied problem solving • You have a problem (E.g Need a program to calculate the area of the circle). • What needs to be done? • What inputs and outputs are needed? • How does what is entered produce the right output?

  3. “…many students have almost no mathematical background and some even arrive with a built-in phobia against anything involving formulae or syntax.” Carter (2004)

  4. “Programming is a complex activity…. Problem Solving is not trivial and requires component skills including relativity; decision making; identification of the central issues; recognition of relationships, familiar situations and patterns; development of an algorithm and the translation of the algorithm into executable code. ” Beaumont and Fox (2003)

  5. Beaumont C and Fox C (2003) “LEARNING PROGRAMMING: ENHANCING QUALITY THROUGH PROBLEM-BASED LEARNING.” [online] 4th Annual conference of the LTSN Centre for Information and Computer Science Galway 26-28th August 2003 http://www.ics.ltsn.ac.uk/pub/conf2003/index.htm accessed on 16th October 2003 • Carter C (2004) “Say it another way Sam: Different Learning Paths” [online] LTSN-ICS One Day Workshop on the Teaching of Programming university of Huddersfield 15th March 2004 http://www.ics.ltsn.ac.uk/pub/programming04/index.html accessed on: 16th July 2004.

  6. Mistakes • An expert is a man who has made all the mistakes which can be made in a very narrow field. Niels Bohr

  7. Mistakes Anyone who has never made a mistake has never tried anything new. Albert Einstein

  8. Simplicity • Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction. Albert Einstein

  9. Simplicity • Everything should be made as simple as possible, but not simpler. Albert Einstein • All quotes taken from:http://www.brainyquote.com/ Accessed on 18/9/2006

  10. How do this course split • Weeks 1-8 • Problem Solving • Weeks 9-24 • Java Programming

  11. Stepwise refinement • Take the problem and break it down in to smaller and smaller chunks that are now manageable.

  12. Basics • Problem statement • Analysis • Design • Implementation • Testing

  13. Analysis – Sample thoughts • What does it have to do? • What does it need? • What rules/algorithms are needed? • When testing what does it take to prove it works? • Can I break this down further?

  14. Things to remember • There is often more than one solution to a problem • You can often solve a problem in many different ways, that each have advantages and disadvantages. • Two heads are better than one • Part of some problem solving techniques can be as simple as discussing issues. • For example: Why did you do that?

  15. Problem 1.1 • Write a routine to calculate the area of the circle. • First pass • Input • Calculation • Display

  16. Second pass • Input • Input radius of the circle • Calculation • Area=Pi x radius x radius • Display • Display area on the screen

  17. Third pass • Put a message of the screen telling the user to enter the radius of the circle. • Read in from the keyboard what the radius of the circle is • Calculation Area=Pi x radius x radius • Display the following message on the screen “The area of the circle is “ and display the result of the calculation on the screen

  18. Problem 1.2: • In groups of 2-3 write a routine for calculating the area of a rectangular room. • First pass • Input • Calculation • Display

  19. What assumptions did you make? • Did you assume that the measurements of the room were already taken? • What units of measurement did you use? • What does area of the room mean? • Area of the floor? • Area of the floor and area of all the walls?

  20. Problem 1.3 • An Ant is in the corner of the a sqaure room. (taken orginally from: Vickers P (2009) How to Think Like a Programmer ISBN 978-84480-903-5 Cengage) • Goal: Is to get to a bowl of sugar in the opposite diagonal corner on the floor. What is the shortest route? • Restrictions: It can’t fly or be blown across the room

  21. Hints • The key to this problem is to re-arrange the problem. • Try flattening the walls.

  22. University of Minnesota – Five steps in problem solving • Understand and isolate the problem • Brainstorm for ideas to solve the problem • Design a solution that might work • Test your solution to see if it will work • Assess whether the solution is good enough to do it • See http://cda.mrs.umn.edu/~fauxr/computing/problemsolve.html

  23. Understand and isolate the problem • What does it take to succeed with a particular problem? • What is the vital information? • Identify the parts of the problems – analysis. • What are the inputs and outputs?

  24. Understand and isolate the problem • Identify the parts of the problems – analysis. • What are the inputs and outputs? • What are the limitations? • What are the rules?

  25. Brainstorm for ideas to solve the problem • Note down all the solutions • Have solutions been used in similar way before? • Keep solutions that have common features . • Two heads are better than one. • When all the solutions have been found weed-out less reasonable ones. • Can be solo or group activity.

  26. Design a solution that might work • The design of a solution can be created using diagrams, algorithms and other models. The main purposes of creating a design that can be viewed by others is to communicate the solution. Providing a diagram or algorithm of what you THINK is going on and is needed will provide others a chance to see what your thinking is.

  27. Test your solution to see if it will work • Take the time to trace through your design with some test information. • Try more than one scenario. • Try to find information that tests the borders. • Choose some information that isn't supposed to work and be certain that the design handles it. • Give your algorithm or diagram to another person.

  28. Assess whether the solution is good enough to do it • Is this solution really worth doing? • Would another solution be better for this situation?

  29. Problem 1.4 • Write a routine that lets the user convert pounds Stirling into the Northampton dollar and display the results • What information do you need? • What does the routine need to do?

More Related