Sunday, December 29, 2019

What is Data structures and algorithms

What is Data Structures and algorithms: If you are a programmer then you should familiarize yourself with the word called data structures and algorithms. because these two words have their own magic when it comes to programming and coding.

and if you are not well enough to know about the data structure and algorithms then you are in the right place. so today we are going to learn that what is data structure and algorithms and why we need to learn it and where these terms used in the programming. 

What you are going to learn.

  1. What is Data Structure?
  2. What is the Algorithm?
  3. What is complexity?
  4. What is time complexity?
  5. What is space complexity?

Data structures and algorithms


What is Data structures and algorithms

What are Data structures

Data structures are a way to represent data in memory. it's a data representation method. and it tells us how and in which manner we represent the data so the use of data has become efficient in the program. 

because every day we deal with thousands of data. so how we can arrange in a manner so that the use of data becomes so efficient for us and others. so that's why the data structures come into existence. 
data structures tell us and give us the methods to how to arrange the data in memory so we can easily handle it.
in data structures, there is arrays, link list, queues, trees, and so on.

let's understand it with an example

for example, if we develop a program that can store the information of thousands of students in a college. so how we can arrange it so we can easily use it in the future. like we use an array or list. so here the data structure tells us that what's really helps you to store. what you need to use list or array. 
so I think now you understand that what is a data structure and why we need to learn and implement it in our program. 
now let's come to algorithms

Also, read


What is Algorithms

an algorithm is a step by step process that tells us how a problem can be solved. it is a process that contains steps to perform a task in a problem. 
like an algorithm for sorting a list or array.

let's understand it with an example

let's take the same example that we have above so a program stores the information of thousands of students in a college. so to sort the name of students we need an algorithm. so we need to develop an algorithm that tells us how we can sort the data step by step. and which task we need to perform. 

so I think now you understand that what is an algorithm and why we need to learn and use it in our program. 

Data structures and algorithms are interrelated. because to develop an algorithm we need to select a data structure. and after selecting a data structure we need to develop an algorithm to perform various operations on the data structure. like sorting, insertion, deletion and searching on a link list, etc. 

But here is a big question for all of us?

That is for a problem there are many different solutions and for every solution, there is an algorithm. so for solving a problem, there are many algorithms. so how we can choose an algorithm to solve a particular task is a problem. 

so we need to choose an algorithm that is efficient to solve a particular problem. like to search an element in a list we have two methods. first is linea search and second is a binary search. so how we need to select a searching algorithm which is more efficient. 

So how we can find the efficiency of an algorithm?
the efficiency of an algorithm depends on two things.

  • Time complexity
  • Space complexity

What is Time complexity

time complexity is a time in which an algorithm needs to complete a task.

What is Space complexity

space complexity is a memory space that an algorithm needs to complete a task. 

like a binary search algorithm needs a sorted array or list and but the linear search algorithm doesn't need a sorted list or array. but if the values are so big in the list then binary search is easy to implement then linear search.

and to select the data structure for our problem we need to understand the different types of data structures and mostly it depends on the situation of our problem. for more information, you can read this post. 

so I think now you understand what is data structures and algorithms and where and how we can select the data structure and algorithm for our problem. 
if you like this post then please share this post as much as you can. and don't forget to subscribe to this blog using your email to get daily updates. 

Previous Post
Next Post

post written by:

Yash is a Full Stack web developer. he always will to help others. and this approach takes him to write this page.

2 comments: