Algorithms and data structures

Software we use today has better quality than ever before. Programs run smoothly with all the high-quality graphics, smooth animation, and complex functionality.

This is often addressed to the processing power of computers, which doubles every two years since the advent of computers. However, there’s another factor with the same importance: the software efficiency. Which is how effectively does software use that processing power and storage to function.

In this subject, we will look at the elements that affect a program’s efficiency and what to do with them. First, algorithms – the logic underlying programs and how to analyze it. Then we learn about data structures – how organized data can help speed up programs. And finally, how to design algorithms.

Prerequisites: You should know at least one programming language.

What is algorithm?
Closely inspect programs, it turns out most of the instruction code has minimal impact on the amount of computation. The problem lies in a small amount of instruction code, where the amount of computation scales with the size of data being processed. Operations like sorting, searching, arithmetic operations, …

We focus on those operations and study the step-by-step plan, the logic lies under – the algorithm, in order to reduce the amount of computation needed to complete those tasks.

Example: Sorting algorithms

Analysis of algorithms
As we often have multiple solutions for one problem, we can have multiple algorithms to achieve a task. In programming, we need to compare those algorithms to find out which one is better for use.

The common-sense approach is to implement algorithms, run them with certain sets of input, and compare the run-time. However, this makes the result depend heavily on the computer environment. And there’s also the problem of choosing a good set of inputs.

This makes analyzing algorithms theoretically the preferred method for analysis of algorithms. With the most common method Asymptotic analysis, where we ignore constant factors and use the order of growth to compare algorithms.

Learn Asymptotic analysis:

Data structures
One of the processes that need large amount of computation is access and modify data from a large data collection. This process can be significantly speed up when data is organized.

Data structures are the theoretical idea of how we can order data. In computer storage, data structures are based on the ability of a computer to fetch and store data at any place in its memory.

<span style="mso-bookmark:OLE_LINK1">There are two types of data structures. <span style="mso-bookmark:OLE_LINK1">Aggregate data structures with all data stored in a single mass. Linked data structures with pointers being used to link aggregate data structures and/or values together. This type of data structures can express more complex relationships between data. However, a set of procedures are required to create and manipulate instances.

Algorithm design paradigms
<p class="MsoNormal">Unfortunately for us, algorithm designing is a problem-solving process. As a result, algorithms can be simple and intuitive or seems completely random. <p class="MsoNormal">While that is a problem, we have several reliable strategies to develop algorithms for specific classes of problems. They are called algorithm design paradigms: