Data Structures and Algorithm: Overview of Algorithms

Oindrila
4 min readAug 16, 2022

--

Let’s talk about Data Structure and Algorithms.

Disclaimer !

Before you proceed!

Note that this series can be considered more of a reference than a full-on tutorial, I am no expert but in here I tried to explain the concepts from my point of view and from what I’ve learned. The reader can consider this as a referring point for a better understanding.

Let’s talk about Algorithms. Data Structure and Algorithms is a known term for every computer science student, including myself. So, in this series we’ll look at different Data Structures and Algorithms. But before we jump into the whole aspect of DSA, we probably should look at what it is.

Series Content:

  1. Overview Of Data Structures(here).
  2. Overview Of Algorithms(here).

ALGORITHMS

How exactly do you define an Algorithm? Personally I feel like it’s best described with an analogy.

Say it’s the middle of the night and you want a late night snack…We all do that sometimes right 😉. So you go down to your kitchen to make yourself some instant noodles. Now there are so many different ways you can make it depending on which one you like, for example you can follow the steps of :

Add water > Water Boils > Add noodle cake > Add seasoning > Enjoy!

p.s. a lot of us actually eat from the pot itself. 😉

or

2. Add water > Water Boils > Add seasoning >Add noodle cake >Put on a plate>Enjoy!

or

3. Add lots of water > Water Boils > Add noodle cake > Drain excess water > Put Noodle on a plate > Add seasoning > Enjoy!

There are so many ways you could make your instant noodles right? But do you see what’s common in them? They all follow a certain sequence of events , and of course not forgetting the end result, you Enjoy! it.

In simple terms an Algorithm is a sequence of events which happen to reach a desired result. So when you’re writing an algorithm , you have a specific result in mind, and there are several different ways in which you can reach that result, and thus there are several different algorithms.

Now, from the above given algorithms, it’s pretty clear that Algorithms 1 and 2 and a lot of less steps and work than Algorithm 3. Or we can also say, it’s a lot more optimised than Algorithm 3. But again, it all depends on the desired result and how we want our resultant, well noodles here, to be like. But most problems in the real world need to be solved in a certain time. So, we need to make sure that we used the most swift and optimised step to get the result. That’s what an optimised algorithm helps us do. The better the algorithm, the faster the result. It has to be correct though otherwise there was no use of optimising it in the first place right.

Now before you write an algorithm, or even read one, there are a few characteristics to it. Here they are

  1. Input : An algorithm can have zero or more inputs to give an output.
  2. Output : An algorithm must produce one or more outputs to the given problem.(Or else why write an algorithm in the first place right!)
  3. Finite : An algorithm must have a finite number of steps to solve a given problem(i.e., the number of steps in an algorithm need to countable). It sure will be a weird algorithm if it goes on forever! 😛.
  4. Unambiguous : Each and every step of the algorithm must clearly define its purpose, i.e., each step should define clearly what it’s intending to do at that point of time.
  5. Feasible : Each algorithm must be feasible to execute. We wouldn’t want an algorithm to execute in our system that takes up a lot of space and runs for a very very long time. That will be like waiting for an instant noodles that takes up loads of time. Not so instant now is it.
  6. Independent : An algorithm should be independent of any programming language. You can write an algorithm in simple English as long as you can communicate it’s purpose.

These are the characteristics of an Algorithm. Every algorithm follows these characteristics.

In the next article we will look at the Overview of Data Structures.

My Socials :
1. Github

2. LinkedIn

--

--

Oindrila

Hello, I am a Software Developer and I love to write about the technologies as I learn about them. Backend | DSA | Java | SpringBoot | LLD | HLD | Coffee