Problem Solving: Programming Techniques
Problem Solving: Programming Techniques
-
Problem solving in programming involves identifying an issue or goal and developing a solution mostly in the form of a programme that solves that issue or achieves that particular goal.
-
To solve problems effectively in programming, it is important to understand the problem fully by breaking it down into smaller, manageable tasks. This is also known as decomposition.
-
Algorithms are vital in problem-solving as they are step-by-step instructions for solving a problem or achieving a goal.
-
To create an algorithm, begin with input, proceed with process and end with output. Inputs are the data that will be processed, process is the operation or function to be performed on the input and output is the result of the processed input.
-
Two types of algorithms used in programming are iterative and recursive algorithms. Iterative algorithms use loops (for, while, do while) to perform actions repeatedly. Recursive algorithms call themselves within their own definition.
-
It is important to always test algorithms for efficiency and accuracy, either by manual walkthroughs or using test data.
-
Abstraction is another key concept in problem solving. It’s the process of removing unnecessary details or generalise shared properties. This simplifies the problem and makes it easier to build solutions.
-
Recursion is a key technique used in problem-solving. It involves a function calling itself within its own code.
-
Sometimes a ‘top down’ approach is used to solve problems. This means breaking down a large problem into a set of smaller problems (also known as subproblems), and then solving each subproblem one at a time.
-
Conversely, a ‘bottom up’ approach starts by solving the smallest or easiest problems first and gradually tackling more complex problems.
-
Pseudocode and flowcharts are often used in problem solving to visually represent the solution before actual coding.
-
Prototyping, or creating an initial, simplified version of the software, is another technique often used to make sure the programme is feasible before a lot of time is spent on development.
-
Debugging is the process of identifying and fixing errors in your code. It is a vital part of the problem-solving process.
-
The dry run technique is often used to verify the correctness of algorithms. It involves manually tracing the algorithm’s progress.