ALERT: UNDER CONSTRUCTION. Please check back next time.

Divide & Conquer


Arthur C. Clarke wrote, "Any sufficiently advanced technology is indistinguishable from magic."

Time for some Cartesian logic: any system can be understood if you break it down to its component parts. Study the parts, figure out what they do, and pretty soon you'll have a good idea of what the whole thing is doing. 

Divide and Conquer has a similar idea; it's a name given to a group of algorithms that take a problem and break it down into two or more sub-problems until it's simple enough to be solved.

The powerful thing about this concept is that it applies to all problem-solving scenarios, even outside programming. Let me give you an example:

It's called port knocking. You want to talk to Server X, which won't respond. The only way to get it to respond is to query Servers A through E in a certain order, during a specified period of time. Only then does Server X talk back.

If you're faced with a task that is too difficult to be resolved in one go, you can simply apply the divide and conquer method. You then back up one level and re-apply until all of the sub-problems are solved.

It's about asking the right questions at the right time. Only then can you truly find resolve.

For example, let's say that you want to remodel a home. That's a complex problem to solve, but what if we were to break it down into sub-problems to be solved instead?

Your algorithm would be...

Home: Infrastructure

  1. Electricity.
  2. Gas lines.
  3. Water lines.
  4. Heating.

Home: Rooms
  1. Kitchen
    1. Tile the floor.
    2. Place the cabinets.
    3. Do the ceiling.
    4. Place the cabinets.
    5. Move in any desired furniture.
  2. Bathroom
    1. Tile the floor.
    2. Place the shower door.
    3. Paint the walls.

If any of these sub-problems are still too tough for you to solve in one go, you can break those sub-problems down to another nest of sub-problems, and so on.

It's all about making sure you approach everything with actionable goals.

Powered by Blogger.