Mark Dixon Page 1 22 – Problem Solving. Mark Dixon Page 2 Session Aims & Objectives Aims –to provide a more explicit understanding of problem solving.

Slides:



Advertisements
Similar presentations
Working With Algorithm and Flowcharts
Advertisements

Internet Applications Development Lecture 3 L. Obead Alhadreti.
Session Objectives# 24 COULD code the solution for an algorithm
Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the five essential properties of an algorithm.
Chapter 8 and 9 Review: Logical Functions and Control Structures Introduction to MATLAB 7 Engineering 161.
EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL MR. SHEA Introduction to Programming
Search and Recursion pt. 2 CS221 – 2/25/09. How to Implement Binary Search Take a sorted data-set to search and a key to search for Start at the mid-point.
Prénom Nom Document Analysis: Segmentation & Layout Analysis Prof. Rolf Ingold, University of Fribourg Master course, spring semester 2008.
Mark Dixon, SoCCE SOFT 131Page 1 08 – Iterative Execution.
Mark Dixon Page 1 20 – Web applications: Writing data to Databases using ASP.
Chapter 2: Algorithm Discovery and Design
Mark Dixon Page 1 04 – Data Types. Mark Dixon Page 2 Admin: On-line Quiz.
Purpose Tags are the key to marking up content on your HTML page. It’s the tags that mark up sections of the page and are defined (aesthetically) on the.
Bug Session Three. Session description In this session, pupils will discover how the Bug software makes drawing shapes easier (this is based on the use.
Games and Simulations O-O Programming in Java The Walker School
ALGORITHMS AND FLOWCHARTS
Mark Dixon Page 1 10 – Iterative Execution. Mark Dixon Page 2 Questions: Variables Write a line of code to declare a variable called h Write a line of.
Unit 1.4 Recurrence Relations
Triangulating a monotone polygon
CS001 Introduction to Programming Day 5 Sujana Jyothi
Parent Mathematics Workshop.
Chapter 13 Recursion. Topics Simple Recursion Recursion with a Return Value Recursion with Two Base Cases Binary Search Revisited Animation Using Recursion.
Phonics and Reading at Westroyd Infant and Nursery School
Invitation to Computer Science, Java Version, Second Edition.
Analysis of Algorithms
1 CS 177 Week 16 Recitation Recursion. 2 Objective To understand and be able to program recursively by breaking down a problem into sub problems and joining.
By the end of this session you should be able to...
Bug Session Three. Session description In this session, pupils will discover how the Bug software makes drawing shapes easier (this is based on the use.
Programming in Java Unit 4. Learning outcome:  LO2: Be able to design Java solutions  LO3: Be able to implement Java solutions Assessment criteria:
Example – Solve the system of equations below We will do this graphically on our calculator. We first need to isolate y in each equation.
BACS 287 Programming Logic 1. BACS 287 Programming Basics There are 3 general approaches to writing programs – Unstructured – Structured – Object-oriented.
Mark Dixon Page 1 05 – Problem Solving & Data Types.
Mark Dixon Page 1 09 – Problem Solving. Mark Dixon Page 2 Admin: Test 1 Marked One-to-one debriefs, you can –Look at your script –Look at mark scheme.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
Program Design. The design process How do you go about writing a program? –It’s like many other things in life Understand the problem to be solved Develop.
Mark Dixon Page 1 05 – Problem Solving & Data Types.
Processing Text Excel can not only be used to process numbers, but also text. This often involves taking apart (parsing) or putting together text values.
1. Take Out Completed Activity 2
Algorithms and Pseudocode
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
Mark Dixon Page 1 09 – Iterative Execution. Mark Dixon Page 2 Questions: Variables Write a line of VBScript code to declare a variable called h Write.
Programming In Python. Starter Using the internet… Find what a programming language is.
Phase 3: Game Creation. Phase 3: Game Creation Outcomes (Slide 1) I can create a flowchart to solve a problem, for example to make a cup of tea. I can.
Algorithms and Flowcharts
CMSC201 Computer Science I for Majors Lecture 19 – Recursion (Continued) Prof. Katherine Gibson Prof. Jeremy Dixon Based on slides from UPenn’s.
Recursion.
AP CSP: Creating Functions & Top-Down Design
CMSC201 Computer Science I for Majors Lecture 20 – Recursion (Continued) Prof. Katherine Gibson Based on slides from UPenn’s CIS 110, and from previous.
3.1 Fundamentals of algorithms
COMPUTATIONAL CONSTRUCTS
Functions and Top-Down Design
CMSC201 Computer Science I for Majors Lecture 18 – Recursion
Understand Problem Solving Tools to Design Programming Solutions
ECE 448 Lecture 4: Search Intro
Yenka Portfolio Level for this topic: Student Name : My Levels
ALGORITHMS AND FLOWCHARTS
Problem Reduction -AND-OR Graph -AO* Search CSE 402 K3R23/K3R20.
Algorithm An algorithm is a finite set of steps required to solve a problem. An algorithm must have following properties: Input: An algorithm must have.
Programming Fundamentals (750113) Ch1. Problem Solving
Theory of Computation Turing Machines.
ALGORITHMS AND FLOWCHARTS
Coding Concepts (Basics)
Compressed springs store energy.
Problem Solving Designing Algorithms.
Robot Intelligence Kevin Warwick.
Flowcharts and Pseudo Code
WindLDR - Script.
Last Class We Covered Recursion Stacks Parts of a recursive function:
4-figure grid references
Presentation transcript:

Mark Dixon Page 1 22 – Problem Solving

Mark Dixon Page 2 Session Aims & Objectives Aims –to provide a more explicit understanding of problem solving skills and strategies Objectives, by end of this week’s sessions, you should be able to: –recognise the key aspects of a problem start state goal state operations –be able to use typical strategies to solve unfamiliar programming problems

Mark Dixon Page 3 Types of problem There are two types of problem: –Known problems: which we have successfully dealt with before, and can remember the solution –Unknown problems: which we have never seen before, and therefore have to discover / invent a solution for ourselves

Mark Dixon Page 4 What is a problem? All problems are different However, have key parts: –Start state –Goal state –set of available operations Problem solving is the process of searching for a sequence of operations that will take us from the start state to the goal state

Mark Dixon Page 5 Important steps It is essential to understand the problem (start state, goal state, and operations) prior to finding a solution It is also often essential to be able to break a problem down into smaller sub- problems, i.e. identify intermediate sub-goal states failure to solve a problem is often due to these

Mark Dixon Page 6 Example: Light Start state: light is off Goal state: light on Set of operations: –Push switch up (turns light on) –Push switch down (turns light off) Solution: 1. Push switch up Simple problems involve a small number of operations to solve

Mark Dixon Page 7 More Complex Problems More complicated problems involve –the use of multiple operations to get from the start to the goal state –conditional execution of operations (only do this if…) –repeated operations (do this until…) –abstraction (more general description)

Mark Dixon Page 8 Example: First Character Start state: the piece of text (e.g. "Hello") Goal state: extract the first character of a piece of text Set of operations: –Right(s, n): gives n characters from the right of s –Left(s, n): gives n characters from the left of s –Mid(s, p, n): gives n characters from s, starting at position p –Len(s): gives the number of characters in s Solution: 1. Left(text, 1)

Mark Dixon Page 9 Example: Horizontal mid point Start state: an image on the screen Goal state: to calculate its horizontal mid point Set of operations: –pixelLeft: gives the position of its left edge –pixelTop: gives the position of its top edge –Width: gives the distance between its left and right edges –Height: gives the distance between it top and bottom edges Solution: 1. get the pixelLeft value 2. add half the Width

Mark Dixon Page 10 Concrete vs. Abstract problems People can solve concrete problems easily –what is the first letter of hello –what is the first letter of you surname –an object's left edge is at position 100 the object is 50 wide where is its mid point? It is often difficult for them to describe the general (abstract) process they use

Mark Dixon Page 11 Goal state Start state Operations –Move Up –Move Down –Move Left –Move Right Solution: Example: Movement 1.Move Up 2.Move Up 3.Move Up 4.Move Right 5.Move Right 6.Move Right 1.Move Up 2.Move Right 3.Move Up 4.Move Right 5.Move Up 6.Move Right or

Mark Dixon Page 12 Example: Movement (abstract) Abstract (general) solution: 1.If current is below goal then Move Up 2.ElseIf current is above goal then Move Down 3.ElseIf current is left of goal then Move Right 4.ElseIf current is right of goal then Move Left 5.Else Stop (current = goal) 6.Go To 1 (loop)

Mark Dixon Page 13 Flowcharts often useful for representing algorithms: below goal above goal left of goal right of goal Start Move Up Move Down Move Right Move Left Stop Y Y Y Y N N N N