THE PATH TO SUCCESS IN EXAM...
Introduction to Problem Solving – Notes
Introduction to problem solving.
- Steps for problem solving ( analysing the problem, developing an algorithm, coding, testing and debugging).
- flow chart and
- pseudo code,
Decomposition
Introduction
Computers is machine that not only use to develop the software. It is also used for solving various day-to-day problems.
Computers cannot solve a problem by themselves. It solve the problem on basic of the step-by-step instructions given by us.
Thus, the success of a computer in solving a problem depends on how correctly and precisely we –
- Identifying (define) the problem
- Designing & developing an algorithm and
- Implementing the algorithm (solution) do develop a program using any programming language.
Thus problem solving is an essential skill that a computer science student should know.
Steps for Problem Solving-
1. Analysing the problem
Analysing the problems means understand a problem clearly before we begin to find the solution for it. Analysing a problem helps to figure out what are the inputs that our program should accept and the outputs that it should produce.
2. Developing an Algorithm
It is essential to device a solution before writing a program code for a given problem. The solution is represented in natural language and is called an algorithm.
Algorithm: A set of exact steps which when followed, solve the problem or accomplish the required task.
Coding is the process of converting the algorithm into the program which can be understood by the computer to generate the desired solution.
You can use any high level programming languages for writing a program.
4. Testing and Debugging
The program created should be tested on various parameters.
- The program should meet the requirements of the user.
- It must respond within the expected time.
- It should generate correct output for all possible inputs.
- In the presence of syntactical errors, no output will be obtained.
- In case the output generated is incorrect, then the program should be checked for logical errors, if any.
Software Testing methods are
- unit or component testing,
- integration testing,
- system testing, and
- acceptance testing
Debugging – The errors or defects found in the testing phases are debugged or rectified and the program is again tested. This continues till all the errors are removed from the program.
Algorithm is a set of sequence which followed to solve a problem.
Algorithm for an activity ‘riding a bicycle’: 1) remove the bicycle from the stand, 2) sit on the seat of the bicycle, 3) start peddling, 4) use breaks whenever needed and 5) stop on reaching the destination.
Algorithm for Computing GCD of two numbers:
Step 1: Find the numbers (divisors) which can divide the given numbers.
Step 2: Then find the largest common number from these two lists.
A finite sequence of steps required to get the desired output is called an algorithm. Algorithm has a definite beginning and a definite end, and consists of a finite number of steps.
Characteristics of a good algorithm
- Precision — the steps are precisely stated or defined.
- Uniqueness — results of each step are uniquely defined and only depend on the input and the result of the preceding steps.
- Finiteness — the algorithm always stops after a finite number of steps.
- Input — the algorithm receives some input.
- Output — the algorithm produces some output.
While writing an algorithm, it is required to clearly identify the following:
- The input to be taken from the user.
- Processing or computation to be performed to get the desired result.
- The output desired by the user.
Representation of Algorithms
There are two common methods of representing an algorithm —
Flowchart — Visual Representation of Algorithms
A flowchart is a visual representation of an algorithm. A flowchart is a diagram made up of boxes, diamonds and other shapes, connected by arrows. Each shape represents a step of the solution process and the arrow represents the order or link among the steps. There are standardised symbols to draw flowcharts.
Start/End – Also called “Terminator” symbol. It indicates where the flow starts and ends.
Process – Also called “Action Symbol,” it represents a process, action, or a single step. Decision – A decision or branching point, usually a yes/no or true/ false question is asked, and based on the answer, the path gets split into two branches.
Input / Output – Also called data symbol, this parallelogram shape is used to input or output data.
Arrow – Connector to show order of flow between shapes.
Question: Write an algorithm to find the square of a number. Algorithm to find square of a number. Step 1: Input a number and store it to num Step 2: Compute num * num and store it in square Step 3: Print square
The algorithm to find square of a number can be represented pictorially using flowchart
A pseudocode (pronounced Soo-doh-kohd) is another way of representing an algorithm. It is considered as a non-formal language that helps programmers to write algorithm. It is a detailed description of instructions that a computer must follow in a particular order.
- It is intended for human reading and cannot be executed directly by the computer.
- No specific standard for writing a pseudocode exists.
- The word “pseudo” means “not real,” so “pseudocode” means “not real code”.
Keywords are used in pseudocode:
Question : Write an algorithm to calculate area and perimeter of a rectangle, using both pseudocode and flowchart.
Pseudocode for calculating area and perimeter of a rectangle.
INPUT length INPUT breadth COMPUTE Area = length * breadth PRINT Area COMPUTE Perim = 2 * (length + breadth) PRINT Perim The flowchart for this algorithm
Benefits of Pseudocode
- A pseudocode of a program helps in representing the basic functionality of the intended program.
- By writing the code first in a human readable language, the programmer safeguards against leaving out any important step.
- For non-programmers, actual programs are difficult to read and understand, but pseudocode helps them to review the steps to confirm that the proposed implementation is going to achieve the desire output.
Flow of Control :
The flow of control depicts the flow of process as represented in the flow chart. The process can flow in
In a sequence steps of algorithms (i.e. statements) are executed one after the other.
In a selection, steps of algorithm is depend upon the conditions i.e. any one of the alternatives statement is selected based on the outcome of a condition.
Conditionals are used to check possibilities. The program checks one or more conditions and perform operations (sequence of actions) depending on true or false value of the condition.
Conditionals are written in the algorithm as follows: If is true then steps to be taken when the condition is true/fulfilled otherwise steps to be taken when the condition is false/not fulfilled
Question : Write an algorithm to check whether a number is odd or even. • Input: Any number • Process: Check whether the number is even or not • Output: Message “Even” or “Odd” Pseudocode of the algorithm can be written as follows: PRINT “Enter the Number” INPUT number IF number MOD 2 == 0 THEN PRINT “Number is Even” ELSE PRINT “Number is Odd”
The flowchart representation of the algorithm
Repetitions are used, when we want to do something repeatedly, for a given number of times.
Question : Write pseudocode and draw flowchart to accept numbers till the user enters 0 and then find their average. Pseudocode is as follows:
Step 1: Set count = 0, sum = 0 Step 2: Input num Step 3: While num is not equal to 0, repeat Steps 4 to 6 Step 4: sum = sum + num Step 5: count = count + 1 Step 6: Input num Step 7: Compute average = sum/count Step 8: Print average The flowchart representation is
Once an algorithm is finalised, it should be coded in a high-level programming language as selected by the programmer. The ordered set of instructions are written in that programming language by following its syntax.
The syntax is the set of rules or grammar that governs the formulation of the statements in the language, such as spelling, order of words, punctuation, etc.
Source Code: A program written in a high-level language is called source code.
We need to translate the source code into machine language using a compiler or an interpreter so that it can be understood by the computer.
Decomposition is a process to ‘decompose’ or break down a complex problem into smaller subproblems. It is helpful when we have to solve any big or complex problem.
- Breaking down a complex problem into sub problems also means that each subproblem can be examined in detail.
- Each subproblem can be solved independently and by different persons (or teams).
- Having different teams working on different sub-problems can also be advantageous because specific sub-problems can be assigned to teams who are experts in solving such problems.
Once the individual sub-problems are solved, it is necessary to test them for their correctness and integrate them to get the complete solution.
- Input Output in Python
Related Posts
Society, Law, and Ethics: Societal Impacts – Notes
Data structure: stacks – notes.
Python Revision Tour I : Basics of Python – Notes
Introduction to Python Module – Notes
Sorting Techniques in Python – Notes
Dictionary handling in python – notes, tuples manipulation in python notes, list manipulation – notes, leave a comment cancel reply.
You must be logged in to post a comment.
You cannot copy content of this page
Browse Course Material
Course info, instructors.
- Prof. Tomás Lozano-Pérez
- Prof. Leslie Kaelbling
Departments
- Electrical Engineering and Computer Science
As Taught In
- Algorithms and Data Structures
- Artificial Intelligence
- Cognitive Science
Learning Resource Types
Techniques in artificial intelligence (sma 5504), lecture notes.
Notes from lectures 6 and 21 are not available.
Lecture 1: What is Artificial Intelligence (AI)? ( PDF )
Lecture 2: Problem Solving and Search ( PDF )
Lecture 3: Logic ( PDF )
Lecture 4.: Satisfiability and Validity ( PDF - 1.2 MB )
Lecture 5.: First-Order Logic ( PDF )
Lecture 7.: Resolution Theorem Proving: Propositional Logic ( PDF )
Lecture 8.: Resolution Theorem Proving: First Order Logic ( PDF )
Lecture 9: Logic Miscellanea ( PDF )
Lecture 10: Planning ( PDF )
Lecture 11: Partial-Order Planning Algorithms ( PDF )
Lecture 12: Graph Plan ( PDF )
Lecture 13: Planning Miscellany ( PDF )
Lecture 14: Probability ( PDF )
Lecture 15: Bayesian Networks ( PDF )
Lecture 16: Inference in Bayesian Networks ( PDF )
Lecture 17: Where do Bayesian Networks Come From? ( PDF )
Lecture 18: Learning With Hidden Variables ( PDF )
Lecture 19: Decision Making under Uncertainty ( PDF )
Lecture 20: Markov Decision Processes ( PDF )
Lecture 22: Reinforcement Learning ( PDF )
- Computer Science and Engineering
- Introduction to Problem Solving and Programming (Video)
- Co-ordinated by : IIT Kanpur
- Available from : 2009-12-31
- Watch on YouTube
- Assignments
- Transcripts
IMAGES
VIDEO
COMMENTS
1. Statingclearlywhat the problem is 2. Defininghow the problem can be solved in a logical sequence of steps 3. Verifying that the solution really does solve the stated problem B. Whenhumans solveproblems by themselves, theyuse a vast array of knowledge and understanding to per-form these problem solving steps.
solving some problem. In fact, computer-based applications often use mathematical models as a basis for the manner in which they solve the problem at hand. In mathematics, a solution is often expressed in terms of formulas and equations. In computer science, the solution is expressed in terms of a program:
1. Problem solving is a skill (it can be learned). It is not an innate ability. 2. Problem solving is fundamentally about attitude and effort (the "problem-solving stance"). 3. The problem-solving stance isn't something that you can just "turn on" when you need it for a test, etc. You have to live it - and successful
Programming for Problem Solving is a digital note that covers the fundamentals of programming concepts and techniques. It is designed for the first year students of engineering at Malla Reddy College of Engineering and Technology, one of the best colleges in Hyderabad. The note includes topics such as data types, operators, control structures, functions, arrays, strings, pointers, files, and ...
Advanced Problem Solving Lecture Notes and Problem Sets Peter Hästö Torbjörn Helvik Eugenia Malinnikova. Contents 1. Basic problem solving techniques 3 1.1. Induction 3 1.2. Combinatorial proofs 3 1.3. Inclusion-Exclusion 4 1.4. The Pigeon-hole principle 5 2. Abstract algebra 6 2.1. Groups 6
Notes 11.2.2 Barriers to Problem Solving Mental set-When you solve a problem in a one particular way, it becomes a set. These are already tried mental operations or steps. This could lead to success in some situation but could also create a kind of mental rigidity that acts as a hindrance to think in new ways, rules and strategies for problem ...
PROBLEM SOLVING TECHNIQUES Problem solving technique is a set of techniques that helps in providing logic for solving a problem. Problem solving can be expressed in the form of 1. Algorithms. 2. Flowcharts. 3. Pseudo codes. 4. Programs 1.ALGORITHM It is defined as a sequence of instructions that describe a method for solving a problem. In other ...
2 PROBLEM SOLVING APPROACH . There are many approaches to problem solving. A general one includes problem identification, generation of solutions, and choosing a solution. We present a six step process, outlined in Figure 3-1. These steps are: 1- Identify the problem 2- Understand the problem 3- Develop a model 4- Solve the model
MIT OpenCourseWare is a web based publication of virtually all MIT course content. OCW is open and available to the world and is a permanent MIT activity
can use problem solving to teach the skills of mathematics, and how prob-lem solving should be presented to their students. They must understand that problem solving can be thought of in three different ways: 1. Problem solving is a subject for study in and of itself. 2. Problem solving is an approach to a particular problem. 3.
1.2 PROBLEM - SOLVING TECHNIQUES Problem solving is a creative process which defines systematization and mechanization. There are a number of steps that can be taken to raise the level of one's performance in problem solving. 1.2.1 Steps for Problem - Solving A problem-solving technique follows certain steps in finding the solution to a problem.
Guide the reader with explanatory text. Qinto. Part (a): Given the pressure (p1) quality (x1) at State 1, we can determine the other properties for this state, e.g., specific volume (v1) and internal energy (u1). We're only given the pressure at State 2 (p2) so we need one moreproperty determine the rest of the properties.
Problem Solving_ Lecture Notes - Free download as PDF File (.pdf), Text File (.txt) or read online for free. Problem solving process
Lecture Notes||Programming for Problem Solving (KCS-101/KCS-201)||S.K. Swarnakar@IT-GCET 7 The cache memory is used to store program data which is currently being executed in the CPU. Approximate access time ratio between cache memory and main memory is about 1 to 7~10
clear, logical thought process to all leadership situations that you encounter. The seven-step process is an excellent tool that can guide you in solving problems and making those sound and timely decisions. The seven steps are: Identify (recognize/define) the problem. Gather information (facts/assumptions).
individual must solve for one's self. Critical thinking skills are nothing more than problem solving skills that result in reliable knowledge. Humans constantly process information. Critical thinking is the practice of processing this information in the most skillful, accurate, and rigorous manner possible, in
e) Finding the iterative construct After solving the smallest problem, the next step is to extend it to the next smallest problem. For example, if we found the solution to the problem for i=0, derive the solution for i=1 f) Termination of loops The termination conditions are dictated by the nature of the problem.
Problem solving is a process of transforming the description of a problem into the solution of that problem by using our knowledge of the problem domain and by relying on our ability to select and use appropriate problem-solving Strategies, Techniques and Tools. Problem solving (with in the context of developing programs) refers to analyzing a ...
Step 1: Find the numbers (divisors) which can divide the given numbers. Step 2: Then find the largest common number from these two lists. A finite sequence of steps required to get the desired output is called an algorithm. Algorithm has a definite beginning and a definite end, and consists of a finite number of steps.
Lecture 2 • 1 6.825 Techniques in Artificial Intelligence Problem Solving and Search Problem Solving Last time we talked about different ways of constructing agents and why it is that you might want to do some sort of on-line thinking. It seems like, if you knew enough about the domain, that off-line you could do all this compilation
Notes from lectures 6 and 21 are not available. Lecture 1: What is Artificial Intelligence (AI)? Lecture 2: Problem Solving and Search . Lecture 3: Logic . Lecture 4.: Satisfiability and Validity (PDF - 1.2 MB) Lecture 5.: First-Order Logic . Lecture 7.: Resolution Theorem Proving: Propositional Logic . Lecture 8.:
Lec 1 - Introduction To Problem Solving and Programming. NPTEL provides E-learning through online Web and Video courses various streams.
Problem Solving-Nonlecture Notes by Ken Monks Math 484 - Problem Solving Department of Mathematics University of Scranton Revised: Spring 2005 Contemplation within activity is a million times better than contemplation within stillness. - Hakuin The Way of Problem Solving Art: Problem solving is an art. Like any art it requires proper attitude ...