lecture12_4on1 - CS1010E Lecture 12 Problem Solving...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS1010E Lecture 12 Problem Solving Methodology Henry Chia hchia@comp.nus.edu.sg 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

Page1 / 6

lecture12_4on1 - CS1010E Lecture 12 Problem Solving...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online