[Jongman Book] 02. Troubleshooting Strategies
Algorithmic Troubleshooting Strategies Chapter 2 Recap
Troubleshooting process
-
Read and understand the problem.
-
Redefine the problem in familiar terms.
-
Plan how to solve the problem.
-
Validate your plan.
-
Implement it as a program.
-
Reflect on how you solved it and look for ways to improve.
1) Read and understand the problem
To avoid making the mistake of misreading the problem, you should read the problem aggressively and try to fully understand what the problem wants. If you miss a small constraint, you will often be unable to solve it, and competitions are often unforgiving of small mistakes.
2) Redefinition and abstraction
Using concepts that are easy for you to work with, rephrasing the problem in your own language is necessary to intuitively understand what the problem is asking of you, and the more complex the problem, the more important it is. Programs that do the same thing can be perceived very differently depending on how you reframe the nature of the problem. Abstraction determines the direction a program will take, as it can make hard problems easier and easy problems harder to solve.
Abstraction: the process of translating real-world concepts into mathematical/computational concepts that are easier for us to deal with.
3) Plan.
Deciding how to solve the problem, choosing the algorithms and data structures to use. This is the most important part of the process, and it's where you'll spend the most time if you don't immediately see a solution to a problem.
4) Validate your plan
Before starting implementation, we need to validate our plan. We need to prove that the algorithm we designed will correctly perform the requirements in all cases, and that the time it takes to perform and the memory it uses are within the limits of the problem.
5) Implementing the plan
Always keep efficiency and accuracy in mind when implementing.
6) Reflect
The step that doesn't have a direct impact right away, but has the biggest impact in the long run. When you re-solve a problem you've solved before, you may find a more efficient algorithm, write more concise code, or even find a more intuitive way to derive the same algorithm. The most effective way to do a retrospective is to write down your experience each time you solve a problem.
Recording your approach, key realizations, and reasons for incorrect answers can help you reduce mistakes and help you pattern. Looking at other people's code that you've solved can also provide insights you might not have thought of.
Refer to other people's code or solutions after a period of time, even if you haven't solved it, but be sure to review it.
Troubleshooting strategies
1) Intuition and systematic approach
-
Have you solved a similar problem before?
- You should be able to understand and transform principles, not just solve them.
-
Can you start with a simple method?
-
Can you solve it without knowing it? There is also a way to create the simplest algorithm and implement it through optimization, starting from
-
You can establish a baseline for algorithmic efficiency
-
-
Can I formalize the process of solving the problem?
- Formalize while solving examples given in the problem, etc.
-
Can I simplify the problem?
- Solving an easier variant of a given problem first
-
Can it be illustrated?
- Geometric shapes are more intuitive to accept
-
Can it be expressed as a formula?
- Plain text → formulas can help solve problems
-
Can the problem be decomposed?
- How to transform the problem into a more tractable form, such as decomposing constraints
-
Can I solve the problem by thinking from the backwards?
-
Typical examples: The ladder game.
-
Can you reduce the number of steps by working your way up from the bottom to the top rather than trying all the paths from the front?
-
-
Can we enforce the order?
-
How to enforce order on a problem that doesn't have it
-
Example: Do, don't, or only 2 cases exist for a single variable / order doesn't matter → Decide whether or not to transform in order.
-
-
Can we only consider certain forms of answers?
-
Normalization techniques
-
How to group answers that are different in form but the same in result, and consider only the group representatives
-
댓글 작성
게시글에 대한 의견을 남겨 주세요.