cs.slides.com/colt_steele/problem-solving-patterns
Basic approaches, Steps you can take to make it solvable
- define what an algorithm is
- devise a plan to solve algorithms
- compare and contrast problem solving
Algorithm - A process or set of steps to accomplish a certain task.
How to improve the skill?
- Devise a plan for solving Problem
how do you approach the problem strategies for breaking it down - Master common patterns
identify categories, keep some recipes
Problem Solving
- Understand the Problem
- Explore Concrete Examles
- Break It Down
- Solve/Simplify
- Look Back and Refactor
Recommended Book How To Solve it by George Polya
Understanding the Problem
It is important to take a step back and just make sure understand the task before typing the code.
- Restate the problem in my own words
make sure I can restate it back. change it a bit in my own words.
- What are the inputs?
- What are the outputs?
- Can the outputs be determinded from the inputs? enough information to solve the problem?
- How should I label the important pieces of data that are part of the problem?
what are the things are really matter the problem? what's the terminology I should use?
Explore Examples
come up with examples can help understanding the problem better
User Stories , Unit Test
- Start with Simple Examples
- Progress to More Complex Examples
- Explore Examples with Empty Inputs
- Explore Examples with Invaild Inputs
Break It Down
take the actual steps of the problem and write them down
just basic component of the solution, little comment as a guide for the steps
Solve / Simplify
- Find the core difficulty in what I am trying to do
- Temporarily ignore that difficulty
- Write a simplified solution
- Then incorporate that difficulty back in
Look Back and Refactoring
- Can you check the result?
make sure the code works - Can you derive the result differently?
different approaches - Can yoyu understand it at a glance?
- Can you use the result or method for some other problem?
- Can you improve the performance of your solutoin?
- Can you think of other ways to refactor?
- How have other people solved theis problem?
'Javascript > Algorithms' 카테고리의 다른 글
Searching Algorithms (0) | 2020.12.23 |
---|---|
Recursion (0) | 2020.12.20 |
Problem Solving Patterns (0) | 2020.12.09 |
The Big O of Objects and Array (0) | 2020.12.06 |
Introducing Big O (0) | 2020.12.03 |