Chapter 10: Divide and Conquer

 Chapter 10: Divide and Conquer

Hey! Thanks for showing the support ❤️ Back with a topic which is not related to only Java but can be implemented in the real world too. Although this is a certified method now, I never learnt this from the internet. And in my opinion it is the easiest and the best way to solve a problem. 

So, what is Divide and Conquer?

Divide and Conquer involves three steps: 
1) Carefully reading/analyzing the problem
2) Dividing the problem into subproblems
3) Finding solutions to those sub problems

And that's it! You can do this for as many times you want, creating a tree of problems and solutions until you get the easiest form of the problem and then solve it step-by-step. 

This rule will help you find the correct approach to a problem and how to find a solution without getting astray from the path. Now comes, how to implement this with programming?

Misconception - It may seem that this method is a time taking method with the number of steps you need to perform. However, it's the opposite. I suggest you to try this technique while creating programs further. And please give your feedbacks too!


Implementation of this rule in programming
This technique can be implemented in programming with the use of algorithms. You can list down the subproblems in your mind or a note and then start finding step by step solution to each problem Ultimately you will have the solution to the problem. Now what are algorithms? An algorithm is a step by step solution to a problem.

For example: Calculate sum of 5 numbers and the sum by 5 and print it
Step 1: Get 5 numbers
Step 2: Add those numbers to get the sum
Step 3: Multiply this sum by 5
Step 4: Print the output

And you have the solution! Even though this was an easy calculation, complex calculations can also be solved easily once you get the hang of it. We shall use this technique to solve any of the programs that are discussed in the upcoming blogs. Ask any queries in the comment section (even anonymously if you are uncomfortable) and leave a feedback! 
Any sufficiently advanced technology is equivalent to magic
 ― Arthur C. Clarke

Image Credits: Khan Academy 

 










Comments

  1. bro its very difficult i am not able to understand programming at this very moment

    ReplyDelete

Post a Comment

Popular posts from this blog

Chapter 1: Introduction To Java

Resources