Algorithm design isn’t easy, but it’s not impossible either. People who design algorithms don’t sit around looking for problems to solve, they are usually already involved in projects when a problem arises that requires a solution. This might not sound that hard because people tend to put algorithms in the same class as functions. However, they are not functions, they are efficient paths to handling data as accurately and quickly as the computer allows.

It takes a special kind of person to design algorithms because the new algorithm has never been used before, and the designer is putting himself on a whole new path. Students at a college of engineering and computer science are likely to develop many algorithms during their study. It’s advantageous to look at other algorithms or written functions but your ultimate goal is to produce an algorithm that solves problems as efficiently as possible.

Every algorithm needs a process in order to be created and utilized. Described below are the four stages of algorithm analysis and design:

Design

The first stage is to identify the problem and thoroughly understand it. This is where it’s important you consult with everybody who has an interest in the problem. Speak with them and see how they see the problem and what they need out of the solution so their part of the project or program can progress.

After you obtain the input, break out the problem into stages and calculate what happens at each step so the next step can occur. All of this is elementary and you probably did this from the first computer science class you ever took, but the same basic rules apply.

This is also the point where you are going to flowchart and/or use pseudo code to work out the specific problems of solving the flow of operations within the code.

Analyze

Once you have the basic framework of the algorithm it’s time to start analyzing how efficient the code is in solving the problem. Algorithm design is fluid and subject to individual plans. This is a step that some programmers like to attack after they have coded the algorithm and run it through the compiler. Others prefer to examine it prior to writing the code and analyze results based on their expectations from the design stage.

Either way, what you are doing is looking for the efficiency of the algorithm. Algorithms are measured in time and space for their efficiency. Look at the algorithm you’re designing and see how it works with different size data structures and what kind of time it takes to work through those structures. The problem here is deciding when the algorithm has reached maximum efficiency for the project and produces acceptable results.

Implement

Writing and coding the algorithm is the next step in the process. If you are the one writing the algorithm, then you need to write it in the coding language you understand the best. In order for you to know how to write the algorithm efficiently you have to know exactly what each line of code is going to accomplish when the program is executed. Write the code to execute quickly but can also handle the input data that it will receive.

If you are part of a team then have the best programmer in your group write the initial code, notate it well so the lesser experienced programmers will understand what is happening as the application is executed.

Experiment

Once the algorithm is designed and coded go back and experiment with different variables in the algorithm. Try and enter data that will make it fail or try and re-write the code to work it out most efficiently. Experimentation in algorithmic design is really just another step of the analyzing of the algorithm. Keep attacking the efficiency aspect until it executes as much data as necessary in the smallest amount of time. When you find flaws in what you have written or ways to write the code better, then go back to the design step and redesign the algorithm.

The design and analysis of algorithms is a circular process. You may find yourself becoming involved in any one of the steps. An experiment on an existing algorithm might lead to a new design. Or a re-coding of an algorithm might lead to a more efficient execution. Wherever you find yourself, keep working towards the goal of efficiency of the algorithm.