slide 1 Problem Solving Techniques for visualizing non-trivial problems and coming up with solutions.

Slides:



Advertisements
Similar presentations
Transformations We want to be able to make changes to the image larger/smaller rotate move This can be efficiently achieved through mathematical operations.
Advertisements

1 Chapter 2 The Digital World. 2 Digital Data Representation.
Graphical Screen Design
S.T.A.I.R.. General problem solving strategy that can be applied to a range problems.
Introduction to Flowcharting
Introduction to Flowcharting
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
James Tam Problem Solving How to visualize/picture/quantify non-trivial problems and derive solution.
Chapter 8 and 9 Review: Logical Functions and Control Structures Introduction to MATLAB 7 Engineering 161.
James Tam Graphical Screen Design CRAP (contrast, repetition, alignment, proximity) Grids are an essential tool for graphical design Other important graphical.
James Tam A High-Level Model For Software Development What is involved in the process of designing, writing and maintaining computer programs?
Polya’s Four Step Problem Solving Process
James Tam Graphical Screen Design CRAP (Contrast, repetition, alignment, proximity) Grids An essential tool for graphical design Other important graphical.
Detailed Design Kenneth M. Anderson Lecture 21
James Tam Introduction To Problem Solving This section will focus on problem solving strategies.
J. Michael Moore Software Design CSCE 110 Influenced by material developed by James Tam & Jennifer Welch.
J. Michael Moore Software Design CSCE 110 Influenced by material developed by James Tam & Jennifer Welch.
Chapter 2: Input, Processing, and Output
A High-Level Model For Software Development
Programming Fundamentals (750113) Ch1. Problem Solving
Copyright © Cengage Learning. All rights reserved. CHAPTER 2 THE LOGIC OF COMPOUND STATEMENTS THE LOGIC OF COMPOUND STATEMENTS.
Today’s quiz on 8.2 A Graphing Worksheet 1 will be given at the end of class. You will have 12 minutes to complete this quiz, which will consist of one.
James Tam Problem Decomposition This section of notes shows you how to break down a large problem into smaller parts that are easier to implement and manage.
(C)opyright 2003 Scott/Jones Publishers Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Scott/Jones Publishers.
Test Preparation Strategies
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
CSC103: Introduction to Computer and Programming
Unit 2: Engineering Design Process
Simple Program Design Third Edition A Step-by-Step Approach
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
Boolean Algebra – the ‘Lingua Franca’ of the Digital World The goal of developing an automata is based on the following (loosely described) ‘ideal’: if.
7 Graph 7.1 Even and Odd Degrees.
Intermediate Algebra Prerequisite Topics Review Quick review of basic algebra skills that you should have developed before taking this class 18 problems.
CS1Q Computer Systems Lecture 8
Chapter 2 - Algorithms and Design
Input, Output, and Processing
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 2.
By the end of this session you should be able to...
ENM 503 Lesson 1 – Methods and Models The why’s, how’s, and what’s of mathematical modeling A model is a representation in mathematical terms of some real.
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Tree Diagrams By Henry Mesa Use your keyboard’s arrow keys to move the slides forward ( ▬►) or backward ( ◄▬) Use the (Esc) key to exit.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Introduction to Flash Animation CS 318. Topics Introduction to Flash and animation The Flash development environment Creating Flash animations  Layers.
 In this packet we will look at:  The meaning of acceleration  How acceleration is related to velocity and time  2 distinct types acceleration  A.
Previous Page Next Page EXIT Created by Professor James A. Sinclair, Ph.D. MMXI Monomials, binomials, and Polynomials Monomials, binomials, and polynomials.
The Hashemite University Computer Engineering Department
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
+ Chapter 5 Overview 5.1 Introducing Probability 5.2 Combining Events 5.3 Conditional Probability 5.4 Counting Methods 1.
INVITATION TO Computer Science 1 11 Chapter 2 The Algorithmic Foundations of Computer Science.
Functions 2 Copyright © Cengage Learning. All rights reserved.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Problem Solving Techniques for visualizing non-trivial problems and coming up with solutions.
ALGORITHMS AND FLOWCHARTS
Problem Solving Techniques for visualizing non-trivial problems and coming up with solutions Introduction to files in Pascal 1.
Problem Solving How to visualize/picture/quantify non-trivial problems and derive solution.
Problem Solving How to visualize/picture/quantify non-trivial problems and derive solution.
Problem Solving Techniques for visualizing non-trivial problems and coming up with solutions Introduction to files in Pascal 1.
Problem Solving Techniques for visualizing non-trivial problems and coming up with solutions Introduction to files in Pascal 1.
1) C program development 2) Selection structure
Problem Solving How to visualize/picture/quantify non-trivial problems and derive solution.
Algorithm Discovery and Design
Problem Solving How to visualize/picture/quantify the problem and the solution.
Tonga Institute of Higher Education IT 141: Information Systems
Problem Solving Techniques for visualizing non-trivial problems and coming up with solutions Introduction to files in Pascal 1.
Tonga Institute of Higher Education IT 141: Information Systems
Problem Solving How to visualize/picture/quantify the problem and the solution.
Copyright © Cengage Learning. All rights reserved.
Presentation transcript:

slide 1 Problem Solving Techniques for visualizing non-trivial problems and coming up with solutions

slide 2 Problem-Solving Computer Science is about problem solving. There isn’t an exact prescribed formula or series of steps that you can learn and apply. This section cannot/will not provide you with a simple set of steps that you can memorize and apply in any situation. – Think about the many ways in which your assignments could have been implemented! What will be provided is a set of approaches that may be used to solve some types of problems. – Afterwards you may be able to apply these techniques when faced with problems that you face in future. OR – You will be able to develop your own approaches.

slide 3 How To Come With An Algorithm/Solution An algorithm is the series of steps (not necessarily linear!) that provide the solution to your problem. “Draw a picture”: If there is a physical analogy to the problem then try visualizing the problem using real world objects or scenarios.

slide 4 How To Come With An Algorithm/Solution (2) If the problem is more abstract (e.g., mathematical and no obvious physical model can be created) – For simple problems this may not be an issue (you can immediately see the solution). – For more complex problems you may be unable to come with the general solution for the program. – Extrapolate the specific to the general: Try working out a solution for a particular example and see if that solution can be extended from that specific case to a more generalized formula. If you can’t get the general formula then try working out the solution to a few more specific examples.

slide 5 James Tam Algorithm != Program Code Although program code is an example of an algorithm not all algorithms must take the form of a computer program. Algorithms due include code but it can take other forms: – Pseudo code – Flowchart diagrams The advantage of specifying an algorithm in pseudo code or a diagram is that you don’t have worry about all the details of syntax. – In the beginning you can focus on just one thing: finding answer to the problem rather than issues such as “How do I do this in Python?”…reduces complexity. – Then when you have created a solution you can worry about issues such as syntax.

slide 6 James Tam How To Find the Algorithm: Pseudo Code Already covered this term: lecture Pseudo code: validating birth While (month is not between 1 and 12) do Prompt user for month If (month is one with 31 days) then while (month is not between 1 and 31) do Prompt user for day If (month is one with 30 days) then while (month is not between 1 and 30) do Prompt user for day If (month has 29 days) then while (month is not between 1 and 29) do Prompt user for day Show month and day of birth

slide 7 James Tam Specifying Pseudo-Code It can specified at different levels of detail (very general to very specific). There is not a hard and fast rule for the detail level. Guidelines: – When creating pseudo code the level of detail must not be as specific as program code (otherwise issues like syntax can take over the problem- solving process). – Yet pseudo code must provide enough detail so that you can eventually use it to write actual program code.

slide 8 Problem #1: Change Making ( Paraphrased from the book “Pascal: An introduction to the Art and Science of Programming” by Walter J. Savitch. Problem statement: Design a program to make change. Given an amount of money, the program will indicate how many quarters, dimes and pennies are needed. The cashier is able to determine the change needed for values of a dollar or less. Actions that may be needed: Action 1: Prompting for the amount of money Action 2: Computing the combination of coins needed to equal this amount Action 3: Output: Display the number of coins needed

slide 9 Problem #1: Change Making How do you come up with the algorithm/solution for determining the amount of change owed? – Don’t just shout the solution! The solution is just the answer to one specific problem: which really isn’t that important). – Instead think about how to come up with the solution This is the ability to come up with a solution to ANY problem as opposed to just knowing the solution to ONE problem. – Problem solving strategies: “Drawing a picture”: no real physical analogy “Extrapolate the specific to the general”: In this case you can try working out the algorithm for a specific example (i.e., how much change do you give back when a specific amount is owed and extrapolate that specific case to the general formula which will work for any amount owed).

slide 10 James Tam Problem #1: Change Making Example amounts of change: – Work out change making for different but specific amounts e.g., $0.25, $0.26, $0.30, $0.32 etc. – Use these specific examples to help you discover the general formula for the problem (in this case making change).

slide 11 James Tam Problem #2: Path Finding (“Chase Algorithm”) Path-finding example: the computer program must find a path from “Point A” to “Point B” on the map. Icewind Dale  Black Isle “Point A” “Point B”

slide 12 James Tam Problem #2: Path Finding (“Chase Algorithm”) This problem is “too hard”? Path-finding was actually part of an old CPSC 231 assignment: – Make the Balrog: ‘B’ chase the Fellowship: ‘F’ (Balrog ‘chases’ or “finds the path towards” the Fellowship. The ‘Fellowship’: human controlled The ‘Balrog’: computer controlled The exit “Lord of the Rings”  George Allen & Unwin (Publishers)

slide 13 James Tam Problem #2: Handout You can find the starting program under: – /home/231/examples/problemSolving/chaseAlgorithm/outline.py Full game – The game creates a 4x5 world – Empty locations are set to a space ‘ ‘ while occupied locations consist either of ‘P’ (player) or ‘M’ (monster) – The ‘player’ is always located at (2,2) – The user is prompted for the starting location of the monster (no error checking under current version). – Based on the starting location for the player and the monster, the program will then move the monster towards (chase) the player.

slide 14 James Tam Problem #2: Students Do Part I: Assume that the destination (row, column) for the monster has already been determined, move the monster from the current location to the destination. – One example: assume these coordinates have been already determined by completing “Part II” Monster source location (0,0), monster destination (1,1) Make the monster ‘disappear’ off (0,0) and reappear on (1,1) Part II: Given that the player has specified the starting location for the monster write the code to determine the destination for the monster (move’s towards the player). – The monster can only move to an adjacent square (one ‘spot’) when chasing the player. – The monster can move onto the same square as the player (appear to ‘engulf’ the player).

slide 15 James Tam Problem #2: Hint What exactly does chase mean? – Move towards, get closer In order to determine what exactly ‘move towards’ means try: – Applying first problem solving technique “Draw a picture”: Create a physical replica of the game world (numbered grid using a white/black board or graph paper). – Applying second problem solving technique “Extrapolate the specific to the general”: Use specific examples of “chase scenarios” to help you determine the solution for any time a chase may occur.

slide 16 James Tam Path Finding / Chase Algorithm: Real Life One last note: the solution needed for this problem was fairly rudimentary. – Ignored the possibility of obstacles, didn’t consider ‘optimal’ paths. – In real life path-finding can be very hard e.g., ‘MapQuest’, Apple ‘Maps’ “Icewind Dale”  Black Isle Oops! Different players take different paths

slide 17 James Tam Problem Solving: Final Hint Keep in mind: a computer is dumb! Each step in an algorithm must be explicitly given to a computer. – Either the programmer writes the step in the form of a program instruction – Or else the programming language includes this information as part of it’s syntax. – When specifying a solution to a problem don’t skip steps!

slide 18 James Tam Detail Level Required: Example What is an algorithm for finding the word in the following collection that comes first (alphabetical order): Dog Cat Bird Fish

slide 19 James Tam Specifying Details: Example …now find the word that comes first sometimes be more a nuisance than a benefit. This was found to be the case in my own investigation of potential change display mechanisms summarized in Chapter 5 and published as Tam, McCaffrey, Maurer, and Greenberg (2000). During this study, many test participants expressed a desire for useful abstractions that combine rudimentary change information into one higher-level conceptual change. For example, one participant noted while watching the animated replay of a class name being shown, “…I don’t need to see each and every character being typed just to see a name change!” Of course, care must be taken to make these abstractions understandable, e.g., by using already familiar representations or notations. This minimizes the cost of acquiring information while maximizing its benefits due to the added structure and organization. Based upon my previous findings (to be discussed in Chapter 5), I add a third dimension, persistence, to Gutwin’s classification. Persistence refers to how long the information is displayed (Figure 4.1 side pane). The display of information is permanent if it is always visible and passing if it only appears for a certain period. We noticed how study participants frequently complained when important information disappeared off the screen. Conversely, they also indicated that screen clutter might occur with the mechanisms that constantly displayed all changes. Thus, there’s a need to classify change information according to how long it should stay visible. With permanent persistence, the effort needed to find changes i.e., the acquisition cost is low because the information is always there. Ideally, a person merely has to shift their gaze over to see the information. Because people can become accustomed to the occurrence of workspace events, they can also ignore things that do not interest them and pay closer attention to things that are of interest (Gutwin 1997). With passing persistence, information about changes is presented only for a limited duration. This is useful when the information applies only to a specific portion of the project (artifact or group of artifacts) being viewed, or when the change information otherwise becomes irrelevant. This is quite an important point for us. The matrix in Figure 4.1 suggests that these dimensions can be combined, giving eight possibilities. For example, a literal, situated and passing display of changes is depicted in Figure 4.2a. The figure shows an animation of a changed circle (by using a ‘replay’ technique) where the circle literally retraces the path that it took as it was moved. It is situated because the animation occurs in the same place that the change actually happened. The persistence is ‘passing’ because once an animation has replayed a change, the information is gone. Figure 4.2b shows two other examples within a concept map editor. The first illustrates the symbolic, situated and permanent octant, where color value (shades of gray) is used to indicate changed ‘Jim’ and ‘Jack’ nodes. Thus, it is symbolic because changes are mapped to a gray scale value, situated because the shading is applied directly to the node that was changed, and permanent because the color values are always on. Figure 4.2b also portrays an example of the symbolic, separate, and passing octant, where a person can raise a node’s change details in a pop-up as a text description by mousing-over the node. Thus it is somewhat separate as the information appears outside the changed node, it is symbolic as it uses the text to describe the changes, and passing because the pop-up disappears when the person moves the mouse off the node (not quite on the node). Exert from “Supporting Change Awareness in Visual Workspaces” (Tam 2002)

slide 20 James Tam Copyright Notification “Unless otherwise indicated, all images and sound effects in this presentation are used with permission from Microsoft.” slide 20