What is Decomposition Computational Thinking?
Computational thinking is a way of thinking logically and solving problems in an organized manner. It is the process of approaching a problem in a structured way and creating & expressing an answer for such a problem that can be easily carried out by a system or machine. This is not only for programmers rather it is applicable in different areas of fields. Having the knowledge of computational thinking, various quantitative and data-related problems can be solved and it will also give you a foundation for solving real-world problems. Computational thinking differs from person to person and let’s say a person thinking about using an algorithm then different persons will think of algorithms in different ways like, a scientist may think of it as an experimental procedure, a computer scientist might understand it as a study of algorithms and its applications, etc. The core concepts of computational thinking include modeling, abstraction, decomposition, algorithmic thinking, logical thinking, etc. An example of computational thinking can be a prediction of weather or climate that can be done only with the help of computer models for a long period of time, etc. In this article, we will learn about decomposition in computational thinking.
Decomposition can be defined as the process of solving a complex problem and breaking it into more sub-problems that can be solved easily. Solving a complex problem may get difficult sometimes but finding the solution for every sub-problem will be simple after which the sub-problems can be put together for finding the full solution to the original problem. It is a divide-and-conquer technique, something seen in various places outside computing. It is important to note that it won’t give you a complete plan of action, rather it provides a starting point for formulating one like for example, a problem may be decomposed with its sub-tasks but it doesn’t show you the order in which you can tackle them. For easier understanding of decomposition:
- Identify the elements or parts of a complex problem
- Divides a task into various subtasks(sequentially)
Importance of Decomposition
- It helps in solving complex problems easily.
- The decomposed sub-tasks can be carried or solved by different persons or a group of persons (if one is not having enough knowledge about the full problem).
- When the problem is divided into sub-tasks each sub-task can be examined in detail.
The best example for decomposition in computer science is Recursion. In recursion, we use it to simplify a problem and break the larger problem into sub-parts and then solve each of the subparts. Some of the real-life common examples that are used in your daily lives of decomposition are given below:
- If you want to make a new game using computer programming then, for making the game, you will write different functions for different actions in the game and then those functions will act as the subprograms or sub-tasks, after which these sub-tasks will be put together to form a full game.
- In sports, sometimes teams break the opposition team up into weaker teams otherwise they will unite into a stronger whole.
- When you want to clean your house, you make a to-do list for doing your tasks.
- When making a Science project, there we need to do various things like background research, experimentation, writing a dissertation, and submitting it, etc. So, that will also be a great example of decomposition.
- A person learns a new language and how to form a sentence using a new foreign language by breaking it down into subparts like subject, verb, and object, etc.
- Another example can be a mathematics problem, Like the following number 256.37 can be written as 2*102+5*101+6*100+3*10-1+7*10-2
A good example of decomposition in computer science can be the merge sort algorithm. In this algorithm, we divide the array into two parts, call itself for the two parts, and then merge the two sorted parts into one. The below algorithm of the merge sort shows that the array is recursively divided into 2 parts till its size becomes 1. Once it becomes 1, the merge process is carried out, and the array is merged completely.
MergeSort(arr, l, r)
If r > l
1. Finding mid point and dividing arr into 2 halves
middle m = l + (r – l) / 2
2. Call mergeSort for first half:
Call mergeSort(arr, l, m)
3. Call mergeSort for second half:
Call mergeSort(arr, m + 1, r)
4. Merging 2 and 3 halves in one:
Call merge(arr, l, m, r)
Please Login to comment...