This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS1010E Lecture 12 Problem Solving Methodology Henry Chia [email protected] Semester 1 2011 / 2012 Department of Computer Science School Of Computing National University Of Singapore CS1010E Lecture 12 – p.1/21 Lecture Outline General problem solving Problem solving process CS1010E Lecture 12 – p.2/21 Problem Solving An entity , E , that solves a problem, P . Input , I , presented to E to solve an instance of the problem, P ( I ) . E outputs S as the solution of P ( I ) . How does E solve P for some general I ? CS1010E Lecture 12 – p.3/21 Problem Solving It is not about whether you can solve the problem, but... Whether you can provide an algorithm (or recipe) for E to solve the problem. The algorithm is exact , effective , general and must terminate . The algorithm is constrained by: the language that E understands; the abstract mechanism behind how E works. CS1010E Lecture 12 – p.4/21 Language What are the primitive values? int , double , char boolean (represented using int ) Representation of problems using primitives, or complex structures involving primitives (e.g. structures, arrays and pointers). Writing syntactically correct program elements or constructs. Communication between modules (function calls and return values). Type-awareness in a typed language. CS1010E Lecture 12 – p.5/21 Abstract Mechanism Assignment Expression evaluation: arithmetic, relational, boolean Type conversions Function call/activation/termination Control flow (flow chart) if .. else , switch .. case while , do .. while , for Pointers, arrays/strings and structures...
View Full Document
This note was uploaded on 12/13/2011 for the course ELECTRICAL CS1010E taught by Professor Henrytan during the Spring '11 term at National University of Singapore.
- Spring '11