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
IMAGES
VIDEO
COMMENTS
THE IMPORTANCE OF PROBLEM SOLVING New Views about Thinking and Problem Solving 3 Some Common Approaches to Problems 7 Mental Escapes I 0 The Purpose and Structure of This Book 12 Notes 13 • Suggested Readings 14 PART I A fRAMEWORK FOR USING KNOWLEDGE MORE EFFECTIVELY I 7 CHAPTER 2 A MODEL FOR IMPROVING PROBLEM-SOLVING SKILLS 19
approach to solve a given problem. It is represented in an English like language and has some mathematical symbols like ->, >, <, = etc. To solve a given problem or to write a program you approach towards solution of the problem in a systematic, disciplined, non-adhoc, step-by-step way is called Algorithmic approach.
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: A program is a sequence of instructions that can be executed by a computer to solve some problem or perform a specified task.
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 ...
We can do this in four steps. 1. Identify all of the nouns in the sentence. Given the 3 dimensions of a box (length, width, and height), calculate the volume. The nouns in the problem specification identify descriptions of information that you will need to either identify or keep track of.
Problem 8 cannot be solved by B - 2C - A, but can be solved by A - C. Problems 6 and 10 can be solved more simply as A - C. Subjects who worked through all problems in order: 83% used B- 2C - A on problems 6 and 7. 64% failed to solve problem 8. 79% used B - 2C - A on problems 9 and 10. Subjects who saw only last 5 problems.
Contents 1 Introduction 1 1.1 Modern Computers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 1.2 Computer Languages ...
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.
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 5- Interpret ...
Newell and Simon. Problem-solving is a search from the problem to the solution. Much like how a computer (in the 60s) would solve a problem. We start in an initial state and have a goal state in mind. Solving the problem involves a sequence of choices of steps, with each action creating an intermediate state.
Solve problems and make decisions effectively. 2.1 Importance of Analytical thinking in the workplace Employers prefer workers with strong analytical thinking skills because they are independent, able to collect and understand information and solve problems quickly. Analytical thinking is very useful and often needed in the workplace.
Math 101 Notes - The Art of Problem Solving ponder things that are perhaps only vaguely related to the problem. This is similar to a smell or gut instinct or intuition that leads you in a certain direction without being 100% certain why you think you ought to go that way. The more you practice,
about problem solving and the factors that contribute to its success or failure. There are chapters by leading experts in this field, includ-ingMiriamBassok,RandallEngle,AndersEricsson,ArthurGraesser, Norbert Schwarz, Keith Stanovich, and Barry Zimmerman. The Psychology of Problem Solving is divided into four parts. Fol-
The Way of Problem Solving. Art: Problem solving is an art. Like any art it requires proper attitude, practice, creativity, and passion to master. Like any artist the problem solver creates works of wonder and surprise and sublime aesthetic value. Beauty: A correct solution is better than no solution.
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 ...
to find a solution for a given problem. The process of writing a program is called programming. 1.2 Classification of Computer Software Computer software can be broadly classified into two groups: 1. System Software 2. Application Software Figure 1.2 Relationship between hardware, system software, and application software System Software
Make your own practice test. Use every resource: Book, online material, teacher office hours, study in the math lab, study partner. Take notes from the book. Try the two-column note taking technique. Keep an organized notebook. . During the Test. Write neatly and you will think neatly. Do the easy problems first.
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.
Problem Solving_ Lecture Notes - Free download as PDF File (.pdf), Text File (.txt) or read online for free. Problem solving process
Courses. Computer Science and Engineering. NOC:Problem Solving through Programming in C (Video) Syllabus. Co-ordinated by : IIT Kharagpur. Available from : 2017-12-21. Lec : 1.
1.4.1 The Stages of Problem Solving. The situation that prevails at the beginning of the problem solving task is the initial state. The system then moves through a series of different, intermediate states, designed to lead to the goal. When the goal is achieved, the system is said to have attained the goal state.
into multivariable calculus or linear algebra problems much outside the scope of this course. But if we have only one parameter, we get a single variable calculus problem. Problem 1: In order to find the best liney = mxthrough the points (1,1),(3,2),(2,5). we have to minimize the function: f(m) = (m−1) 2+ (3m−2)2 + (2m−5) . Find the minimum.
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.
In problem-solving, the brain uses all its cognitive abilities such as critical thinking, decision-making, and reflective thinking to process the information and provide resolutions to the ...