DEV Community

Cover image for Algorithm Design Technique I: Introduction
Olagunju Joshua Gbolahan
Olagunju Joshua Gbolahan

Posted on • Originally published at Medium

Algorithm Design Technique I: Introduction

Algorithms are part of our daily life routine; in different areas of our lives, we perform different tasks and solve daily problems in a defined way. As software engineers, developers, and IT administrators, these parts of our work description are inevitable. Quite often we come to situations where a particular problem or task has more than possible ways of solving it. In situations like this, how do we choose the best solution and provide better efficiency? will be covered in this article.

Algorithm is what developers say when they do not want to talk about wha they do

What then is an “algorithm”? An algorithm can be said to be a well-defined, finite set of instructions, approaches, or rules clearly designed to achieve a task or solve a problem.

Notice I used in the definition “well-defined,” because for any solution to be termed an algorithm, it needs to be well defined; otherwise, it is a “heuristic,which is an approach to solving problems that do not have a well-defined, correct, or optimal result.”. Algorithms are widely applied in different areas of IT. In mathematics, computer programming, and computer science, an algorithm generally refers to a defined process for solving repetitive problems. They also serve as instructions for carrying out data processing operations and are essential to automated systems.

Characteristics

  1. Definite start: Every algorithm begins with a well-defined starting point. This ensures clarity on where the process starts and under what conditions the algorithm is initiated.
  2. Input: An algorithm requires specific input values, either given initially or generated during the process. These inputs are the raw data or parameters necessary for the algorithm to function.
  3. Process Flow: The algorithm follows a step-by-step sequence of operations, which is the core of the process flow. Each step in the flow is precise and must be executed in a logical order to reach the solution.
  4. Output: After completing the process, the algorithm produces an output, which is the solution or result derived from the input. The output must be relevant to the problem the algorithm is solving.
  5. Desired End: The algorithm must have a clear and defined end condition. This means it should terminate after a finite number of steps, leading to a solution or a conclusion.

When implementing an algorithm, there are two things to be considered:

  1. Correctness: An algorithm should correctly solve the problem for all valid inputs, meaning it must produce the right output based on the given inputs and expected process flow.
  2. Efficiency: The efficiency of an algorithm refers to how well it uses resources like time and memory. An efficient algorithm performs tasks in the shortest possible time and with minimal computational overhead, ensuring optimal performance.

Representation
Algorithms can be expressed in many kinds of notation, including natural languages, pseudocode, flowcharts, drakon-charts, programming languages or control tables (processed by interpreters). Natural language expressions of algorithms tend to be verbose and ambiguous and are rarely used for complex or technical algorithms. Pseudocode, flowcharts, drakon-charts, and control tables are structured expressions of algorithms that avoid common ambiguities of natural language. Programming languages are primarily for expressing algorithms in a computer-executable form, but are also used to define or document algorithms.

Algorithm representation

Types
Often times, these problems have more than one approach to solving them and therefore require an approach to the correct solution that is more efficient than the other solutions. This approach is what gave rise to the following different algorithmic techniques that will be discussed in this series:

  1. Complexity analysis
  2. Recurrence relation
  3. Recursion
  4. Backtrcking
  5. Divide and Conquer
  6. Gredy technique
  7. Dynamic Programming

It should however be noted that algorithms, although they can be implemented in different programming languages, are not language-specific.

Very well then! You’ve come to the end of this article. In the next session, we’ll look into the different ways of implementing algorithms in our software development.

Top comments (0)