alogorithm
Hello and welcome to this course.
So in this particular course we will talk about what is data structure and algorithm.
In a short course, we are talking about this term as DSA in entire course just keep in your head that this full form is data structureand algorithms.
So that's what we will try to cover up in our this entire course.
So basically what we will try to do is that we will try to understand first of all what is data structure.
After that we will try to understand what are the key aspects of algorithm, what is an algorithm and how basically we can solve any problem statement with the help of a different kinds of algorithms.
Now obviously before moving ahead towards this session I thought that it's quite important as a initial point to understand that after all why this data structure algorithms is required?
What's the motivation behind learning these things right?
So let me try to connect the examples which is in a real life practical scenarios.
So that you will try to appreciate that why you are learning these things and then going forward you will see that we are having a different sessionswhere we are talking about different kinds of data structure and different ways to solve any problem using a different kinds of algorithm.
Now the question is first of all what do we mean by data structure?
I hope as the name suggests, data structure is a way to structure your data.
Right?
Now structured meaning the organization.
We want to organize the data in such a way so that it's easy to retrieve the datait's easy to store the data right.
For example you are going to a library and in that library the books are not organized.
For example they are not under the heading of science or commerce or computer science.
So you will get if suppose you want to search for a book it will take a lot of time.
On the other hand if the book is organized under its main headingwhich is written on the bookshelf then it's quite easy for us to check which book we want to get and whether that whether that book is available in the library or not.
So basically the important point here to understand is that that what we want is we want a structured data.
In order to structure the data we have different kinds of data structure.
Now here how many different kinds of data structure we have?
Here you will see that we are havingvarious different different kinds of data structure.
One is linear based and one is non-linear based.
For example array, for example linked list.
These are a kind of a linear based data structure where for example stack, for example queues.
What is happening is that there is a somewhere linearity.
All the elements are are ordered in such a way that they are forming a linear fashion.
Ok.
Now apart from that, we are having something called as trees.
We are having something called as graph.
Right!
So these are the different kinds of data structure that we have and many more.
Right!
So here if you will see, the question came obviously in your head that why these many data structures are required?
Can't one be enough to give the entire information or to store the entire information?
No.
The answer is no.
Why is that so?
Let me try to give you one simple example.
I hope everyone knows the undo operation that we used to do in our system.
Right?
What is this undo operation says?
So the keyword is Ctrl+Z that we used to type while doing the undo operation.
So usually what happened is that, suppose I deleted some content.
uh Now if suppose I want to get that content again, so what will happen is that, I will just press Ctrl+Z.
I will just press Ctrl+Z.
Right, now this is something where whatever be the last information I have, that will come out.
So last in, first out.
This is something the application of a stack based data structure.
That's where developers when designed this keyword, they have implemented the stack based data structure.
Which is basically used to store the last information that we are typing.
Right!
Now this is something which we are saying is a example of a stack based data structure.
Because inside that particular operation, we want to implement the LIFO kind of terminology.
Similarly, suppose you want to build some network.
Suppose what I would say is that that suppose you are booking some Ola cabs.
There is a booking system obviously we all know I hope everyone is aware about that.
So either suppose I am using Ola or I am using Uber.
So what is happening is that I used to enter the destination and after entering the destination when I click on the search button it will try to look for the nearest cabs right.
And according to that it will also give me the charges also.
So here what is happening is that we are booking some, we are making some sort of networking on the basis of the distance, on the basis of the petrol required it is giving the charges as well.
So here if you will see what is happening is that a graph based data structure will work into picture mainly breadth first search.
So there are two types of graph.
traversals that we have BFS and BFS.
So here we want to find out the shortest distance right.
Uh So that's where the BFS came into picture.
So these things whatever I am writing here, I'm not expecting that you all know because these things we will already we will obviously discuss in our upcoming sessions.
But here I want to just try to give you the real-life applications.
Real life applicationsWhere I want to suggest you that how basically these things are useful so that you will try to appreciate and you will now when you will go in future anywhere you will try to observe that OK.
Here data structure is implemented.
Here algorithms is going on.
So what is an algorithm?
The logic on top of these data structures is something which we are saying as a algorithm.
Now ok, apart from that, I hope everyone is having the Spotify to listen the music.
Right!
Now suppose in a Spotify, I am moving towards next.
So what is happening is that I will be able to get the next music.
I will be able to get the next music.
And when I am moving towards the previous, I am able to get the previous listened music.
Right!
So here if you will see, in a way I am dealing with two pointers.
One is next and one is previous.
And that is something which is an application of Spotify and that is something is implemented on the top of a linked list.
linked list.
Right, now it can be a doubly linked list where we are having the two pointers next and the previous.
It can be a circular linked list where the last particular music is connected with the next uh first one.
So that's where the circular linked list is coming into picture.
Depending uponwhat kind of app you are using.
This kind of data structures are useful.
Now this is where the pointers come into picture.
Apart from that, if suppose you are going towards any e-commerce website.
Okay.
You are going for any e-commerce website.
There you find out that there is a products.
Under productsAgain we are having any subcategory which is a subproduct.
Ok.
And under that, I am able to get the final product which I want to order.
Right!
Now, here if you will see, this is something which is a root node.
This is something which is a leaf node, the final product which I want to get.
This is something which is an internal node.
Now, what is this all about?
This is something which is an application of, I hope everyone is able to understand this point as well, Tree based data structure.
Tree based data structure.
Right?
Moreover, now,I hope with the help of all these real life examples, you guys will be able to get an understanding that it completely depends on the use case.
It completely depends on the scenario which you are trying to solve.
For example, you have a records of students.
Suppose you have a records of students and you want to store those records.
So students marks are there inside that record.
So here I am having suppose may be five students.
and I am storing the marks of those students.
Suppose out of 100, one student got 55, one got 95, one got 80, one got 85 and another one got 70.
Now this particular students marks the question is if suppose someone is saying that these students marks in this particular data my uhvery frequent operation is suppose insertion and deletion.
Means in the record, I used to do insertion and deletion more frequently, very frequently.
In that particular case, you will observe that the linked list is much preferable data structure.
Because in linked list, it will take just constant amount of time to insert or delete any node.
Whereas the same question if I am saying that the searching is very much frequent.
The searching is very much frequent.
So that's where you will say that okay if the searching is frequent, array is more preferable.
Because in an array, there is a concept of random access.
There is a concept of binary search with the help of which we will be able to optimize our searching algorithm but in linked list it's not like that.
So basically if you will see the same problem also can be solved using different data structures depending upon what use case we try to solve.
So with the help of all this explanation, what I want to tell you is that that it simply depends on what kind of problem you are trying to solve and with the help of which you should be aware about what kind of data structure you will be using here.
So that's where the different kinds of data structure plays a very important role and that's why there is a need to learn every data structure in a very much depth.
Apart from that as I told you the algorithm is something the problem logic that we are trying to solve on top of these data structures.
Algorithm is something which is a sequence of steps that that too finite steps I would say to solve any particular problem and obviously when you are trying to solve any particular problemthat particular problem will you you will solve but before that you will try to save the data in some data structure.
That's where this concept is coming into picture.
So now in algorithm also we are having different different kinds of algorithms.
For example divide and conquer, greedy or dynamic programming.
All these things I will cover up in my next upcoming session.
But I hope that the questionwhich is that why this DSA is required or why we are learning this concepts of data structure and algorithm.
I hope it's pretty much clear to everyone.
I must say that data structure is something which you will find in every real life scenario because it's the foundation of everything.
Ok.
So just try to observe now after going back to your home that where you are observing that this kind of data structure in your real life applications is useful apart from the examples that I gave you.
With this, I hope that the concept is pretty much clear to everyone and now you all are also excited with me to start a new course of DSA where now I'll start about I'll talk about that what is an algorithm in my next session.
Happy learning to all.
Bye bye everyone.
See you soon in the next upcoming session.
Comments
Post a Comment