Computer Science

Planning Your Steps with Algorithms

An algorithm, simply put, is a flowchart of the steps you will take, including the various options you plan to exercise for each contingency you are able to plan for. In computer science practically speaking one must plan for every contingency before coding something up, or the computer will fail in a number of ways, depending on which contingency the programmer failed to plan for.

The logic behind the algorithm also tends to determine the efficiency of the overall program, and is therefore one of the main “sticking points” in computer science instruction. Frequently taught in terms of “search” the ability to sort through a pile of data points to find the one you are looking for is an important function for a computer to fulfill.

An algorithm is also an important way of organizing information, and activities, for example, a family trying to set up an emergency plan for a natural disaster like an earthquake, may set it up in terms of an algorithm (and probably should).

If it happens during the day > Kids follow teachers’ instructions, Mom checks on Kids, Dad checks on Mom. If all is fine Dad stays at work if not checks on Kids, then checks on Mom.

If it happens at night > Rendezvous at mailbox out front, if everyone is fine check on old lady next door, if not find missing party.

Team sports can set plays according to an algorithm, search and rescue parties can use them for more efficient search, nearly any activity that wants to benefit form a prearranged st of instructions to individual members to coordinate their efforts will all benefit from a properly constructed algorithm.  Even an individual wanting to be a step ahead can predetermine large parts of their path by this method, and with practice it only takes a moment to come up with one.

Generally you would build this algorithm around “conditional logic”, as in, IF this event should happen, THEN we will use our emergency algorithm. So the earthquake happens, now what.

If it happened in the day > Kids follow teachers’ instructions, Mom checks on kids at school, Dad contacts Mom, if all is well stays at work, if not checks on kids at school, then looks for Mom.

If it happened in the night >

When All Else Fails: Brute Force and Iteration

“Brute Force” as a term used by hackers and computer scientists generally refers to a simple algorithm or method, repeated until a desired result is achieved. It takes a lot of time, sometimes expressed as “linear” time. That’s exactly as long as it sounds like. Imagine a number line extending toward infinity and starting at one, count every integer until you get to the one that I’m thinking of.

This is one of the primary ways of cracking passwords, and why it’s such an important idea to pick a good one

Sometimes there just ISN’T a clever trick or a way to work around the problem. That’s when Brute Force comes into its own.

A few key points to improve the results when you’re reaching for your Brute Force hammer.

1. This is usually people’s first response, when it should often be their last. Check carefully to make sure a better option isn’t available. Why use a ‘leave no stone unturned’ strategy to find a fugitive, if bloodhounds are available? After searching high and low for a better method, take a deep breath, and commit to the task at hand.

2. Optimize. Back to the password cracking analogy, there have been many lists of the most common passwords, published in order of frequency. Just knowing that a given set of passwords is not evenly or randomly distributed through the population, the obvious thing then, would be to start at the most common (the key that opens the most doors gets tried first), and work your way toward random groups of characters. (This is why you should NEVER use a password from this list). This is hardly the only thing to do to optimize, again, look high and low before proceeding to the next step.

3. Hurry up. In password cracking terms this would mean getting a faster computer. For physical applications (checking out groceries, for example) this means breaking the task into simple steps, and getting well versed in each step, so that no one speed bump can hold up the whole process. This step can be reattempted often to find further improvements once a venture is already underway.

That’s really about it. Brute Force is rarely a genius technique. But knowing when and how to use it, and being willing to try in earnest may be the difference between success and failure in certain applications.