Navneet Singh Once a wise man said me, 'words are mighter than a sword'. Living up to the wise man wisdom.

Foundation Course On Algorithms

Foundation Course On Algorithms

What will you learn in this blog post:

  • What is an algorithm
  • Kinds of problems solved by algorithm
  • General terms and definations related to algorithm
  • Algorithm as a medium of technology

In this fundamental course on algorithm you will be able to build a strong understanding related to algorithms. What kind of problems does it solve, why is it necessary to write an algorithm before implementing it in code and much more. A general understanding of the same has been explained, so hop on this exciting journey of algorithm and let’s get started.

So, lets start with the most fundamental question of all time. What is an algorithm?

Before rambling terms related to algorithm, let us consider a very primitive example that dates back in 1879, it was the day when the first electric bulb was created, way before computers and algorithms were invented. What did the electric bulb do, it would take electricity as an input and produce light as an output while going through carbon filaments as a medium. Very similar to that electric bulb, an algorithm takes an input or a set of values as input, goes through a set of instructions to produce the desired output.

Moving ahead of 1879 and landing our conscious today. Suppose we are given a set of numbers from 1 to 100 but arranged in a random manner. We have to produce an output such that all the numbers are arranged in increasing or decreasing order. So we have

Input: Sequence of numbers in a random manner from 1 to 100 <n1,n2,n5,n3…n100>

Output: Sequence of numbers in ascending or descending order from 1 to 100 <n1,n2,n3,n4…n100>

We can use a large number of logics at our disposals like quick sort, merge sort, bubble sort and many more. We will be discussing about each and every algorithm in detail. But for now we know that the input mentioned above goes through a set of instructions/ an algorithm (like quick sort, merge sort, etc) to produce output mentioned above.

Many program use an algorithm as an intermediate step. Like in case of sorting we received a set of input on which the sorting algorithm will be applied. Since sorting is such a fundamental step, we have a large number of algorithm at our disposal, however which algorithm to apply for a given set of input is a main challenge.

An algorithm is specified in English language as a computer program or a hardware design.  

What kinds of problems are solved by algorithm?

Sorting is not the only example for which algorithms are developed, there is a large number of examples which are solved by algorithm.

If we talk about the internet, all the bytes transferred and received by your system are done via algorithm, moreover, a good algorithm will be able to deliver your IP packets in a much efficient manner than a less efficient algorithm.

Coming out of the internet, your operating system in your computer works on specific protocols and algorithm to perform parallel functions and do so many things at once.

Even the google maps which are accessible on a click of a button require an algorithm to process it.

Mainly anything which you can access via technology has a strong algorithm working at the backend to provide you the optimum experience.

General terms and definations related to algorithm

Data Structure: Suppose you have a large packet of chips, now you want to store those chips in a bowl to eat it when you are watching a movie. Now that bowl acts like a data structure for you. A data structure is a way to store and organize data in order to facilitate, access and modification. No single data structure is good for all problems; every data structure has its unique elements which it brings to the table.

Hard problems : Most of the algorithms which we discuss in this blog are focused about efficiency and speed. The faster it can process a large input, the higher the efficiency of the algorithm is. However, there are some problems for which no efficient algorithm is known, such type of problems are called NP-complete problems or hard problems.

Parallelism: From the last couple of years, processor’s clock speed has been increasing at a constant rate, physical limitations does possess a roadblock to increasing speeds. In order to increase the speed and perform more computations per second, chips are being designed to contain not just one core but several cores. In other words we have created a type of parallel computer. In order to elicit the best performance from a multiprocessor, we need to design algorithm with parallelism in mind which takes the advantage of multiple cores and multithreading.

Algorithm as a technology

Suppose your computer was infinitely fast and you had infinite computer memory, would you have any reason to study algorithm? The answer is yes, if for no other reason, you would want to demonstrate how efficient your algorithm is and whether it produces the correct output or not.

You would want to implement it within the bounds of good software engineering practices ( for example, your implementation should be well designed and documented ).

That’s all for now folks! The above blog should give a pretty good understanding of algorithm, what kind of problems does it solve and how is it used as a technology. Within our next chapter we would look into the efficiency of an algorithm and a lot more.

comments powered by Disqus