Solutions that are inefficient
If computational thinkingA problem-solving method using computer science techniques, where possible solutions are developed and presented in a way that can be understood by humans and computers. techniques are applied to the problem of how to bake a cake, on decompositionThe breaking down of a system into smaller parts that are easier to understand, program and maintain. the problem, the solution would state 鈥 among other things 鈥 that certain quantities of particular ingredients are needed to make the cake.
For the first ingredient, it might tell us to go the cupboard, get the ingredient, and bring it back to the table. For the second 鈥 and all other ingredients 鈥 It might tell us to do the same.
If the cake had three ingredients, that would mean three trips to the cupboard. While the program would work like this, it would be unnecessarily long and complicated:
It would be more efficient to fetch all the ingredients in one go, and the program would be shorter as a result:
The solution is now simpler and more efficient, and has reduced from nine steps to five.
The problem occurred here because some steps were repeated unnecessarily, making the solution inefficient and overly long.