Problem Solving Techniques in Computer Science
Problem-solving is the process of identifying a problem and finding the best solution for it. Problem-solving is a technique that can be developed by following a well-organized approach. Every day we encounter many problems and solve them.
Every problem is different. Some problems are very difficult and are needed more attention to recognize the solution.
A problem may be solved by multiple methods. One solution may be faster, cheaper, and more reliable than others. It is important to choose a suitable worthy solution.
Different strategies, techniques, and tools are used to solve a problem. Computers are used as a tool to solve complex problems by developing computer programs.
Computer programs contain different instructions for computers. A programmer writes instructions and the computer executes these instructions to solve a problem. A person can be a good programmer if he has the skill of solving problems.
There are three different types of problem-solving techniques.
A set of instructions given to a computer to solve a problem is called a program.
A computer works according to the given instructions in the program. Computer programs are written in programming languages. A person who develops a program is called a programmer.
The programmer develops programs to instruct the computer on how to process data into information. The programmer uses programming languages or tools to write programs.
Advantages of Computer Program
Different advantages of computer programs are as follows:
- A computer program can solve many problems by giving instructions to the computer.
- A computer program can be used to perform a task again and again and fastly.
- A program can process a large amount of data easily.
- It can display the results in different styles.
- The processing of a program is more efficient and less time-consuming.
- Different types of programs are used in different fields to perform certain tasks.
Algorithms & Pseudo Code
An algorithm is a step-by-step procedure to solve a problem. The process of solving
problem becomes simpler and easier with help of algorithm. It is better to write an algorithm
before writing the actual computer program.
Properties of Algorithm
Following are some properties of an algorithm:
- The given problem should be broken down into simple and meaningful steps.
- The steps should be numbered sequentially.
- The steps should be descriptive and written in simple English.
Algorithms are written in a language that is similar to simple English called pseudocode. There is no standard to write pseudo code. It is used to specify program logic in an English-like manner that is independent of any particular programming language.
Pseudocode simplifies program development by separating it into two main parts.
In this part, the logic of the program is designed. We specify different steps required to solve the problem and the sequence of these steps.
In this part, the algorithm is converted into a program. The steps of the algorithm are
translated into instructions of any programming language.
The use of pseudo-code allows the programmer to focus on the planning of the program. After the planning is final, it can be written in any programming language.
The following algorithm inputs two numbers calculate the sum and then displays the result on the screen.
2. Input A
3. Input B
4. Total A+B
5. Display Total
The following algorithm inputs the radius from the user and calculates the area of a circle.
Hint: Area 3.14* radius* radius)
2. Input radius in r
3. area = 3.14* r* r
4. Print area
Advantages of Algorithm
There are many advantages of an algorithm
Writing algorithm and program separately simplifies the overall task by dividing it into two simpler tasks. While writing the algorithm, we can focus on solving the problem instead of concentrating on a particular language.
An algorithm is written so that the code may be written in any language. Using an algorithm, the program could be written in Visual Basic, Java or C++, etc.
Ease of Understanding
It is not necessary to understand a particular programming language to understand an algorithm. It is written in an English-like manner.
A flowchart is a combination of two words flow and chart. A chart consists of different symbols to display information about any program. Flow indicates the direction processing that takes place in the program.
Flowchart is a graphical representation of an algorithm. It is a way of visually presenting the flow of data, operations performed on data, and the sequence of these operations.
Flowchart is similar to the layout plan of a building. A designer draws the layout plan of the building before constructing it. Similarly, a programmer prefers to design the flowchart before writing the computer program. Flowchart is designed according to the defined rule.
Uses of Logic Flowchart
Flowchart is used for the following reasons
- Flowchart is used to represent an algorithm in a simple graphical manner.
- Flowchart is used to show the steps of an algorithm easily.
- Flowchart is used to understand the flow of the program.
- Flowchart is used to improve the logic for solving a problem.
- Programs can be reviewed and debugged easily.