Applying Algorithmic Design

An algorithm is defined as a procedure or set of rules to be followed in calculating or solving a problem.

A data structure is a special format for organizing, processing, retrieving or storing data.

Algorithmic design and data structure techniques can be powerful tools when designing programs.  Whether you are trying to develop an efficient search, perform an efficient iteration of a function, or build efficient data containers like linked lists or stacks, being able to effectively harness these techniques is important.

Different algorithms or data structures may be more efficient or more useful in different situations, so having a good understanding of the problem you are solving for is the first critical step.  It is important to take factors like time and space complexity and ease of implementation into account when choosing the right solution for your program.

If you are trying to search a list for a value, a binary search is likely faster than a linear search (assuming you are able to sort your chosen data structure).  Rather than looking at each individual element, we can immediately rule out half of the available data points by checking the mid point, and determining if your value is more or less than the mid point, and repeat until you have found your needed datapoint.

If you are trying to build a data container that needs to handle first in first out requests, you will want to use a queue.  If it needs to be something like first in last out - you would want to leverage a stack.

When developing structured programs we should break out problems into smaller more manageable tasks, applying the right tool for the job.  By doing this we make the different tasks more manageable, and easier to understand in your code.  You can then re-use different parts of your program to solve similar problems.



Comments