1 / 77

Computational Problem Solving

Computational Problem Solving. Chin-Sung Lin Eleanor Roosevelt High School. Computational Problem Solving. Problems Problem S olving Approaches Computational Problems Solutions for Computational Problems Impacts of Computational Problem Solving What is an Algorithm?

radwan
Download Presentation

Computational 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. Computational Problem Solving Chin-Sung Lin Eleanor Roosevelt High School

  2. Computational Problem Solving • Problems • Problem Solving Approaches • Computational Problems • Solutions for Computational Problems • Impacts of Computational Problem Solving • What is an Algorithm? • Representation of Algorithms – Flow Chart • Representation of Algorithms – Pseudo Code • Algorithms of Skyscrapers Project

  3. Problems

  4. Problems are obstacles, difficulties, or challenges which invite solutions

  5. Problems are EVERYWHERE

  6. Problems Education Healthcare Economic Biology Internet Transportation

  7. Problem Solving Approaches

  8. Problem Solving Approaches 3 Problem Solving Approaches in Science and Engineering Experimental Analytical Computational

  9. Problem Solving Example How can we build a projectile intercepting system?

  10. Problem Solving Approaches Example 3 Problem Solving Approaches (3 Types of Models) Experimental Analytical Computational

  11. Problem Solving Example Analytical (Mathematical) Model

  12. Problem Solving Example Experimental Model

  13. Problem Solving Example Computational (Simulation) Model

  14. Problem Solving Example 3 Problem Solving Approaches (3 Types of Models) Experimental Analytical Computational

  15. Computational Problems

  16. Computational Problems • Decision Problems • Function Problems • SearchProblems • Sort Problems • Counting Problems • Optimization Problems

  17. Decision Problems • A computational problem where the answer for every instance is either yes or no. • Example: The primality testing - "Given a positive integer n, determine if n is prime." A decision problem is typically represented as the set of all instances for which the answer is yes.

  18. Function Problems • A computational problem where a single output of a function is expected for every input, but the output is more complex than that of a decision problem, that is, it isn't just YES or NO. • Example: The integer factorization problem, which asks for the list of factors.

  19. Sort Problems • A computational problem where elements of a list need to be put in a certain order. • The most-used orders are numerical order and lexicographical order. • Example: Order the students in a class according to their ages from older to younger.

  20. Search Problems • A computational problem where it searches an element from a given list of elements. • Example: Find students with first name Peter in Elroclasslist.

  21. Counting Problems • A computational problem where it counts the number of occurrences of a type of elements in a set of elements. • Example: A counting problem associated with factoring is "Given a positive integer n, count the number of nontrivial prime factors of n.”

  22. Optimization Problems • A computational problem where it finds the "best possible" solution among the set of all possible solutions. • Example: Use a Google Map to find the shortest path of driving.

  23. Solutions for Computational Problems

  24. Problem Solving Process 4-Step Problem Solving Process Specification Testing Algorithm Programming

  25. Problem Solving Example: Counting Money • Suppose you want to count out a certain amount of money, using the fewest possible US bills and coins • US monetary system: $100, $20, $10, $5, $1, 25¢, 10¢, 5¢, 1¢ • Example: To make $56.39, what should you do?

  26. Problem Solving Example: Counting Money • Suppose you want to count out a certain amount of money, using the fewest possible US bills and coins • US monetary system: $100, $20, $10, $5, $1, 25¢, 10¢, 5¢, 1¢ • Example: To make $56.39, what should you do? • At each step, take the largest possible bill or coin that does not overshoot

  27. Problem Solving Example: Counting Money • Suppose you want to count out a certain amount of money, using the fewest possible US bills and coins • US monetary system: $100, $20, $10, $5, $1, 25¢, 10¢, 5¢, 1¢ • Example: To make $56.39, what should you do? • At each step, take the largest possible bill or coin that does not overshoot • two $20 bills, to make $40 • a $10 bill, to make $50 • a $5 bill, to make $55 • a $1 bill, to make $56 • a 25¢ coin, to make $56.25 • a 10¢ coin, to make $56.35 • four 1¢ coins, to make $56.39

  28. Problem Solving Example: Counting Money • Suppose you want to count out a certain amount of money, using the fewest possible US bills and coins • US monetary system: $100, $20, $10, $5, $1, 25¢, 10¢, 5¢, 1¢ • Example: To make $56.39, what should you do? • At each step, take the largest possible bill or coin that does not overshoot • two $20 bills, to make $40 • a $10 bill, to make $50 • a $5 bill, to make $55 • a $1 bill, to make $56 • a 25¢ coin, to make $56.25 • a 10¢ coin, to make $56.35 • four 1¢ coins, to make $56.39 • For US money, this algorithm always gives the optimum solution

  29. Problem Solving Example: Counting Money • Suppose you want to count out a certain amount of money, using the fewest possible coins • Fictional monetary system: $12, $8, $1 (coins) • Example: To make $17, what should you do?

  30. Problem Solving Example: Counting Money • Suppose you want to count out a certain amount of money, using the fewest possible coins • Fictional monetary system: $12, $8, $1 (coins) • Example: To make $17, what should you do? • At each step, take the largest possible bill or coin that does not overshoot • a $12 coin, to make $12 • five $1 coins, to make $17

  31. Problem Solving Example: Counting Money • Suppose you want to count out a certain amount of money, using the fewest possible coins • Fictional monetary system: $12, $8, $1 (coins) • Example: To make $17, what should you do? • At each step, take the largest possible bill or coin that does not overshoot • a $12 coin, to make $12 • five $1 coins, to make $17 • This algorithm needs six coins and is NOT the optimum solution

  32. Problem Solving Example: Counting Money • Suppose you want to count out a certain amount of money, using the fewest possible coins • Fictional monetary system: $12, $8, $1 (coins) • Example: To make $17, what should you do? • At each step, take the largest possible bill or coin that does not overshoot • a $12 coin, to make $12 • five $1 coins, to make $17 • This algorithm needs six coins and is NOT the optimum solution • The better way is to use

  33. Problem Solving Example: Counting Money • Suppose you want to count out a certain amount of money, using the fewest possible coins • Fictional monetary system: $12, $8, $1 (coins) • Example: To make $17, what should you do? • At each step, take the largest possible bill or coin that does not overshoot • a $12 coin, to make $12 • five $1 coins, to make $17 • This algorithm needs six coins and is NOT the optimum solution • The better way is to use • two $8 coins, to make $16 • a $1 coin, to make $17 • This way needs ONLY three coins and IS the optimum solution

  34. Impacts of Computational Problem Solving

  35. Problem Solving Example: A Kidney Story • Kidney disease affects 50,000 new Americans a year. Kidney Exchanges can save lives! • Kidney transplants are often their best option for saving their life.  • The demand for kidneys far outstrips the supply from deceased donors.  • For patients with kidney disease, the best option is to find a living donor — a healthy person willing to donate one of their two kidneys. • In a live donation, a potential donor and the intended recipient must be compatible, which can be quite rare.  • In order for patients to obtain a compatible donor, they can swap donors. • A pool of incompatible patient-donor pairs where one tries to find swaps is called a kidney exchange.

  36. Problem Solving Example: A Kidney Story • In the simplest exchange, you have two patients each with an available donor kidney, and both patients are compatible with the other’s donor kidney. • When compatibility doesn't match, looking for a third person can make the exchange work —this is called a "3-cycle exchange”. • Longer cycles can yield more matches, but are often difficult to manage. 3-Cycle Exchange 2-Cycle Exchange

  37. Problem Solving Example: A Kidney Story • Consider the exchange below. A patient is connected to a donor if they are biologically compatible. A donor will only donate a kidney if his or her friend also receives a kidney. What is the optimal exchange for this situation? Why? • What technique will you use to solve this problem? How would your technique scale if there were ten donors and patients? 100? Thousands?

  38. Problem Solving Example: A Kidney Story • 60 Lives, 30 Kidneys, All Linked (New York Time article: February 18, 2012) • Prof. TuomasSandholmand his research group from CMU developed an algorithm that can compute the optimal matching for a U.S.-wide kidney exchange (~10,000 patients) in about an hour. The optimal matching is the one that results in the largest number of exchanges. • http://www.nsf.gov/cise/csbytes/newsletter/vol1/vol1i6.html

  39. Problem Solving Example: A Kidney Story • Matching algorithms can be applied to a variety of other problems that require similar barter exchanges. • The National Odd Shoe Exchange lets people with differently sized feet agree to swap shoes to avoid having to buy two pairs each (http://www.oddshoe.org), • Read It Swap It lets people swap books (http://www.readitswapit.co.uk//TheLibrary.aspxx), • Intervacallows people to swap vacation houses (http://www.intervac-homeexchange.com), and • Netcyclerallows people to swap, give away, and get items for free (www.netcycler.com).

  40. What is an Algorithm?

  41. An Algorithm is a finite set of well-defined instructions for effectively carrying out a procedure or solving a problem.

  42. An Algorithm is a finite set of well-defined instructions for effectively carrying out a procedure or solving a problem.

  43. Examples of Algorithms

  44. Examples of Algorithms

  45. Representations of Algorithms

  46. Representations of Algorithms • Show the logic of how the problem is solved - not how it is implemented. • Readily reveal the flow of the algorithm. • Be expandable and collapsible.  • Lend itself to implementation of the algorithm.

  47. Representations of Algorithms • Flowcharts • Graphical representation of control flow • Pseudocode • A sequence of statements, more precise notation • Not a programming language, no formal syntax

  48. Representation of Algorithms – Flow Chart

  49. Start or stop Representation - Flowcharts Process Elements of flowcharts Input or output Decision Flow line Connector Off-page connector

  50. Examples of Flowcharts An algorithm for findingthe area of a circle of radiusr.

More Related