How to Think Algorithmically

An algorithm is a problem-solving method that uses logical reasoning to accomplish tasks as efficiently as possible. Although you might think only computers use algorithms, in reality, people solve problems algorithmically every day. If you’d like to improve your own algorithmic thinking, approach every problem like a logical task. Identify the problem clearly, and then input as many details about the problem as you can. Use the “if-then” approach to determine the best steps to solve the problem efficiently. Practice this way of thinking every day by using the algorithmic approach for all your daily tasks, drawing decision trees, and playing games to sharpen your logical reasoning.

[Edit]Steps

[Edit]Working out Problems Logically

  1. Identify and define the problem clearly to determine how to proceed. All algorithms start with a clear definition of the problem or task. Take a look at the task at hand and define the problem as clearly as you can. With this information, you can then design the sequence of steps to solve the problem in the most logical way.[1]
    Think Algorithmically Step 1.jpg
    • Once you identify a problem, put it into a simple sentence. For example, if your house is always messy, you could say, “I need to develop a system to organize my belongings better.”
    • These problems don’t have to be complicated. You can use the same logical reasoning to decide what you want to eat. The problem might be, “I can’t decide what to order off the menu.” This is a clear definition of a problem and task that must be solved.
    • Alternatively, you may just have a task rather than a problem. Your task may be, “I need to finish food shopping within 30 minutes.” Use the same techniques to accomplish this task.
  2. Input up all the information you already know. An algorithm only works if you enter the correct inputs for the system to solve a problem. Treat your brain the same way. It can only solve problems if it has the correct information. Once you identify and state a problem, start designing your strategy to solve it. Observe the situation and learn more. Add up the additional information you gather and state the problem more clearly.[2]
    Think Algorithmically Step 2.jpg
    • For example, your problem might be, “My car is making a weird noise.” This is a good start, but too broad for effective problem-solving. Input more information on where the sound comes from, what it sounds like, and when it appears. Work that down to, “My car makes a metallic rattling noise from the front end when I apply the brakes at over 30 mph.”
    • This strategy also works with simple tasks. If you only have 30 minutes to complete your food shopping, start by inputting your shopping list and the store layout. Then use that information to plan the order you go down each aisle in.
  3. Break down all tasks into smaller chunks. Make each task as basic as possible. This makes the problem-solving process much more manageable. Don’t worry about coming up with the correct order of events yet. At this point, just list all the minute things you have to accomplish to work the problem out.[3]
    Think Algorithmically Step 3.jpg
    • If you wanted to clean your home, for example, think about how you’d break the task down. You’d have to vacuum, scrub the bathroom floors, pick up dirty clothes, take out the trash, do the dishes, dust the cabinets, and wash the windows. These tasks aren’t necessarily in order, but they’re manageable tasks that you can break down further.
  4. Organize steps into the most logical order. Algorithms are all about solving tasks in the most efficient way possible. After you’ve defined your problem and broken down the necessary tasks, put those tasks in the most logical order. Think about each step that depends on a previous one, and order the tasks around this relationship.[4]
    Think Algorithmically Step 4.jpg
    • Sticking with the home-cleaning example, think about the most logical order for your tasks. Logically, you can’t vacuum the floor until you pick up the clothes, so pick up the clothes first. Similarly, you can’t wash the windows if the floor is wet from mopping, so clean the windows before you mop the floor.
  5. Anticipate variables by using the “if-then” approach. Not all problems have a simple sequence of events. In many problems or tasks, there are multiple paths that can change based on the inputs. This is where the “if-then” approach comes in, and it’s a key part of algorithms. Think about the different variables you might encounter when solving this problem. Then consider what you would do if you encountered each variable. With this approach, you can work your way through a problem like a logical system.[5]
    Think Algorithmically Step 5.jpg
    • If your problem is a strange noise in your car, this approach can help you locate it. Your sequence could be: “If the sound is a screech coming from the tires, then I will check the brakes. If the sound is a metal knocking, then I will check the engine.”
    • This approach is basically how an algorithm works, and can get very detailed. Add as many inputs as you need to determine all the variables that can occur.
  6. Design your steps around the variables you might encounter. After breaking down the steps and anticipating variables, then come up with a design on how to solve the problem. Think about this process like a flow chart. Map out your sequence of actions and which steps you'll take if you encounter certain variables.[6]
    Think Algorithmically Step 6.jpg
    • Sticking with the car example, think about how you'll locate the noise your car is making. Then, when you've found the source, plan the following steps on how you'll fix the problem.
    • The following is a logical sequence of events based on the variables you'd encounter while fixing a car: If the sound is coming from the tires, I'll check the brakes. If the brakes are new, I'll check my bearings. If the bearings are bad, I'll replace them. If I can't find the source of the noise, I'll take the car to the mechanic.
    • If you were designing a computer algorithm, it would need very accurate steps and inputs planned down to the last detail. Since the human mind can handle more nuance than a computer, you can be a bit more general with your steps when you're solving a problem.[7]
  7. Plan a loop in your algorithm if you don't solve the problem at first. Designing an algorithm can be a trial-and-error process, and you may not get it right the first time. In this case, plan on going back to the start and working through the problem again. In computer programming, this is a loop. Think of it as a "back to the drawing board" approach to work through problems.[8]
    Think Algorithmically Step 7.jpg
    • Loops are important because they prevent you from going down a path that isn't working. If your initial solutions aren't solving the problem, then performing the same actions is counterproductive. Circling back and redesigning your approach has a much better chance of success.
    • A loop would be useful if you can't find the source of the noise in your car. You initially anticipated the problem may be the brakes or engine, but in your investigation, you find that it wasn't coming from either spot. In this case, loop back to the start. Drive the car around, apply the brakes, and use different speeds to try and find the source of the noise.
  8. Execute the actions based on the variables you encounter. With the planning stage done, begin solving your problem. Work through your flow chart and follow specific actions based on the variables you encounter. Follow the process until you locate the root of the problem and solve it.[9]
    Think Algorithmically Step 8.jpg
    • Here is an algorithmic way to fix your car: There is a strange noise coming from my car. If it's a screech, I'll check the tires. If it's a knock, I'll check the engine. The sound is a screech, so I'll check the brakes. I remove my brake pad and see that it's worn out. I install a new brake pad and the noise is gone. I've solved the problem.
    • Remember that your algorithm may encounter unexpected variables. You might be checking your brakes, only to find out there's also a hole in your tire. This is an entirely new problem that requires a new set of actions. Adjust your approach if you do hit unexpected variables.

[Edit]Practicing in Your Everyday Life

  1. Approach your daily tasks as they are algorithms. The world is full of more algorithms than you might realize, people just usually don’t think about them in this way. Practice your algorithmic thinking by solving your daily tasks as if they’re algorithms. Plan out logical steps and use the if-then approach to accomplish them. Over time, you’ll get used to solving problems this way.[10]
    Think Algorithmically Step 9.jpg
    • A recipe, for example, is essentially an algorithm. It solves the problem of creating a meal using a logically-ordered list of steps.
    • Think about your commute to work. You might say, “If there is traffic on the highway, I’ll take the side streets.” This is another everyday algorithm many people use all the time.
  2. Plan your outfits using the if-then approach. Getting dressed is a great everyday example of an algorithm. Everyone makes a set of decisions based on the weather, workplace, day of the week, and personal style to choose their outfits. Visualize these steps as an algorithm to train your mind to think algorithmically.[11]
    Think Algorithmically Step 10.jpg
    • A simple algorithm for getting dressed is: “If it rains, I will wear a jacket. It is not raining. Therefore, I won’t wear a jacket.” This is a logical flow of steps.
    • Another good example is, “If we have a meeting today at work, I’ll wear a tie. If we don’t, I’ll dress casually.”
  3. Make a decision tree or flow chart to work problems out. Sometimes algorithms are difficult to visualize, especially when they get more complex. Create a visual plan for your decisions by making a decision tree or flow chart. At the top, put your problem or task. Then list the possible steps you can take to accomplish the task. Be as specific as you can. When you’ve done that, organize the steps into the most logical order to accomplish the task.[12]
    Think Algorithmically Step 11.jpg
    • A flow chart is helpful if you already know the general order of the steps. For brainstorming, use a decision tree.
    • For a flow chart on writing a class paper, write your main thesis at the top. Then jot down all the evidence you have to prove that thesis. Arrange the evidence in a logical order that supports the thesis best, and construct your paper in that order.
    • If you don’t know where to start, draw a circle naming the task. Draw lines from the circle and write out steps for how you might solve the task. Then start eliminating steps that don’t seem helpful. Finally, you’ll be left with a list of steps that will help you.
  4. Play algorithm games to sharpen your skills. In addition to solving your daily tasks with algorithms, games can help you think algorithmically as well. There are many computer games and programs that are designed to improve logical thought. Search the internet or app stores to find logic games that can improve your thinking while entertaining you as well.[13]
    Think Algorithmically Step 12.jpg
    • A strategy board game like Risk is a good low-tech option that you can play with your friends. The game involves planning and responding to inputs and variables. Games like this are a fun way to train your algorithmic skills.
    • Chess is also a great board game for logical thinking.
    • Check for apps and mobile games as well. There are many logic games that can help improve your thinking skills.

[Edit]References



from How to of the Day https://ift.tt/2xlsrTv
via IFTTT