School of Computing Science CMT1000 © Ed Currie Middlesex University 1 CMT1000: Introduction to Programming Ed Currie Lecture 1B: Problem Solving.

Slides:



Advertisements
Similar presentations
Problem Solving and Algorithm Design
Advertisements

DT Coursework By D. Henwood.
“The study of algorithms is the cornerstone of computer science.” Algorithms Winter 2012.
ITEC113 Algorithms and Programming Techniques
Standard Index form OCR Module 8.
Using Algorithms Copyright © 2008 by Helene G. Kershner.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 1 CMT1000: Introduction to Programming Ed Currie Lecture 2B: Programming.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 6: 1 Progress By now you should have: Worked through units 1 to 5 of the learning.
CMT1000: Introduction to Programming Ed Currie Lecture 2A: Pizza.
Lecture Notes 1/21/04 Program Design & Intro to Algorithms.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 5a: Input and.
Chapter 1 Program Design
Design & Analysis of Algorithms Introduction. Introduction Algorithms are the ideas behind computer programs. An algorithm is the thing which stays the.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
CSCI-100 Introduction to Computing Algorithms Part I.
Objective: To convert numbers into standard index form
Chapter An Introduction to Problem Solving 1 1 Copyright © 2013, 2010, and 2007, Pearson Education, Inc.
Invitation to Computer Science, Java Version, Second Edition.
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
Computer Science Department Data Structure & Algorithms Lecture 8 Recursion.
CS 1308 Computer Literacy and The Internet Software.
Algorithms CS139 – Aug 30, Problem Solving Your roommate, who is taking CS139, is in a panic. He is worried that he might lose his financial aid.
Lecture 6 Problem Solving: Algorithm Design & Analysis.
Fundamental Programming: Fundamental Programming K.Chinnasarn, Ph.D.
Chapter 1 Program design Objectives To describe the steps in the program development process To introduce the current program design methodology To introduce.
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
What's The Plan? Algorithmic Thinking Step-by-step directions for whatever someone, or the computer, needs to do © 2004 Lawrence Snyder.
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.
… Computer Science Inside… Algorithm Development.
The Beauty and Joy of Computing Lecture #6 Algorithms I UC Berkeley EECS Sr Lecturer SOE Dan Garcia.
Introduction to programming Carl Smith National Certificate Year 2 – Unit 4.
A Puzzle for You. Puzzle Someone is working for you for 7 days You have a gold bar, which is segmented into 7 pieces, but they are all CONNECTED You have.
© Janice Regan, CMPT 128, February CMPT 128: Introduction to Computing Science for Engineering Students Recursion.
Programming Introduction. What is a program? Computers cannot think for themselves, they can only follow instructions. A program is a set of instructions.
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
CS 104 – Fall 2011 Exploring Computer Science Build Your Own Blocks September 19, 2011.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Problem Solving.  Similar to Solving Math Word Problem  Read the Problem  Decide how to go about Solving the Problem  Solve the Problem  Test the.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Modelling & Simulation of Semiconductor Devices Lecture 1 & 2 Introduction to Modelling & Simulation.
The Beauty and Joy of Computing Lecture #6 Algorithms I Jon Kotker UC Berkeley EECS 2010, 2013 Microsoft
Algorithms and Problem Solving
Topic: Introduction to Computing Science and Programming + Algorithm
Topic: Programming Languages and their Evolution + Intro to Scratch
CS1371 Introduction to Computing for Engineers
Using Algorithms Copyright © 2008 by Helene G. Kershner.
Lecture 2 Introduction to Programming
Yenka Portfolio Level for this topic: Student Name : My Levels
Using Algorithms Copyright © 2008 by Helene G. Kershner.
Unit# 9: Computer Program Development
Program Design Introduction to Computer Programming By:
Computational Thinking
Problem Solving Skill Area 305.1
The PlayStation Example
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
slides courtesy of Eric Roberts
Computational Thinking
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Presentation transcript:

School of Computing Science CMT1000 © Ed Currie Middlesex University 1 CMT1000: Introduction to Programming Ed Currie Lecture 1B: Problem Solving

School of Computing Science CMT1000 © Ed Currie Middlesex University 2 Problem Solving Programming is all about solving problems. A program is just a set of instructions that describe how to solve a particular problem: –written in a language that a computer can understand.

School of Computing Science CMT1000 © Ed Currie Middlesex University 3 Problem Solving There are 4 steps to solving a problem: UNDERSTAND THE PROBLEM WORK OUT A PLAN SORT OUT THE DETAILS TEST AND EVALUATE The same applies to writing a program too!

School of Computing Science CMT1000 © Ed Currie Middlesex University 4 Understand the Problem Most important step! What information do we know? What do we want to happen? How can one lead to the other? In programming –this involves talking to customers –what do they want?

School of Computing Science CMT1000 © Ed Currie Middlesex University 5 Understanding a Programming Problem For the programming exercises do you understand what you are required to do do you understand the programming constructs you will need to use –(if not make sure you understand them before you start) do not start to write a program until you have understood the problem

School of Computing Science CMT1000 © Ed Currie Middlesex University 6 Different Solutions I want to eat Pizza –… I have lots of options Go to a Pizza Restaurant Phone a Pizza delivery place Cook a frozen one Make one myself

School of Computing Science CMT1000 © Ed Currie Middlesex University 7 Same Plans - Different Details Pizza Restaurant –Pizza Express v Pizza Hut –Leicester Square v local Frozen –buy one with toppings –add your own toppings Make your own –different recipes for base

School of Computing Science CMT1000 © Ed Currie Middlesex University 8 Different Solutions There are many different ways to achieve a task Trade-off between advantages and disadvantages of each What is best depends on the situation Given a plan –still different ways to do it Programming is about devising plans –the above all apply

School of Computing Science CMT1000 © Ed Currie Middlesex University 9 Algorithms A plan for solving a problem by following a sequence of rules is called an algorithm An algorithm should be (at least) –complete (i.e. cover all the parts) –unambiguous (no doubt about what it does) –deterministic (only 1 possible result) –finite (it should finish) Exercise: Decide whether the noughts and crosses solution is an algorithm.

School of Computing Science CMT1000 © Ed Currie Middlesex University 10 First write the algorithm  First write the algorithm......Writing a program from it will then be easy!  It is easier to write a set of rules for playing noughts and crosses than writing a program to do it. The former is one step on the way to writing a program.

School of Computing Science CMT1000 © Ed Currie Middlesex University 11 Breaking A Problem Down You can probably execute some pizza plans without further instruction eg heat up a frozen pizza  Others need to be broken down into smaller steps  eg make your own pizza or go to a Pizza Hut Go to restaurant Order Pizza Eat Pizza Pay Bill Go home

School of Computing Science CMT1000 © Ed Currie Middlesex University 12 Sub-tasks “Go to restaurant” may need to be broken down even further. Go to restaurant: –Go to Leicester Square Tube Station –Turn right out of tube –Go about 300 m –Its on the right, on the corner

School of Computing Science CMT1000 © Ed Currie Middlesex University 13 Subtasks Break down each plan until you get to steps you know how to do Programs are written in the same way –you must break the task down into steps the computer can execute –there are different ways of doing it

School of Computing Science CMT1000 © Ed Currie Middlesex University 14 Test And Evaluate Step through the solution Make necessary changes Check the results –are they valid –is it a solution to problem –is it what was wanted

School of Computing Science CMT1000 © Ed Currie Middlesex University 15 Testing Programs step through on paper ("DRY RUN") then run on computer try lots of different test cases

School of Computing Science CMT1000 © Ed Currie Middlesex University 16 Summary We solve a problem with a computer by devising a plan (an algorithm) We break the plan down into steps the computer can do (a program) There are many plans and many ways of breaking them down Which is best will depend on the situation