Problem-Solving
How can we simplify complex problems?
Problem solving is at the core of computer science, and there are a few key concepts to keep in mind and utilize when approaching problems, no matter how small. The first is decomposition, which is one of the greatest motivators for the use of functions. Decomposition is the practice of breaking down a problem into smaller, much simpler parts that can be combined back together to solve the larger problem.
For example, imagine you were tasked with creating a search engine like Google. Seems pretty difficult, huh? But what if you broke it down like this:
- • Get input from the user
- • Search for keywords in a dataset containing the information on webpages
- • Rank the results by number of times the word appears
- • Display the rankings in greatest to least order
That feels much more doable, or at least I would know where to start. Now, each of those tasks may still seem complicated, but the same process could be repeated until each sub-problem is small enough to feel manageable. The best part about your problem-solving strategies is that you can control how far you decompose the problem. Now, functions can take on each of the sub-problems and the code will start to organize itself by sub-problem and ease the solving process.
While we continue development of our own educational articles, we recommend checking out this article on the problem-solving process and computational thinking. It includes a series of articles that all cover related and important topics.