Introduction to Data Structure & Algorithms #2
Hello guys, today we are going to talk about a definition of data structure example of data structure, why we need data structure. Yeah, the data structure and algorithm using in c++. That is what we'll be discussing today. Now, what is Data structure data structure is one of the most important aspects, fundamental in computer science, or an IT, information technology. Mostly, very important when you're using into programming on development domain where you build and we be an efficient software system application mean it is a fundamental so get it that allow the organization and post nesting of information, as the lead in our computer. Now the definition of data structure data structure is a data organization management.and storage format that enables efficient access
and modification now if we try to look into this definition There are some important words that are highlited , like, organization, and the organization. This simply means that the textbook show of users, a program is to organize their data in such a way that, It will be easier to access and money made it important to manage our data storage, and storage. It's a help us to modify our storage is to be used to prevent Save, an unnecesary storage space, thinking. And, yeah, we also talk about efficient and assess efficient assets or with data social, it was, we, we, like a Google, Microsoft, that have a lag that that cloud storage.
Yeah, it is they have data social that enables them to be able to access those defense efficiently and easily, a modification for what define. Yeah, and are the engine of our data, and all information for easy and efficient assets Now, in short them within say that data structure is a specialized format for organizing processing. Me too when uninstalling of data. Yeah. Now, why do we need data structure data structure, l. So is the way of storing and amazing data or information. any computer so that it can be retrieved on using most productive way. Yeah, it's opposed to organize our data, or our information so
that it can be used, and it will be easy to access this data that are stored in our computer. It is low. It is just like an implement a set of rules, which define our data will be thought and assets, Now, let's talk about the sizes of data structure data structure allows efficient data safe and retrieval. It allows our users to be able to say, and retrieve a setting that up that stone in the computer is in data structure allows data to be stored in a specific manner. There are different way of storing data, what we have data structure, we can be able to store our data in a different format, maybe we would update especially with a wink. saw our data, a base document we use that as an extension for or do we not mp4, but that mpg that we have our way of different manner, and format of storing our data. Under color of targets this of data structure
is that it allowed to manage large amounts of data and database and indexing services. Yeah, it's a lot to manage large amounts of data, such as like database and indexing services, such as like our hash table. Now for still on less than, all these window we are going to state, until about some examples of data structure. known. Now, the face example we are going to talk about you is using this Excel sheet known in this Excel sheet, we have rows and columns for also stage, a particular salary of candidates. We did have data, the way we structure our data and we we are indeed. using the ID number.
It will be easy to trace the salary of each candidates, is in a certain ID number, known in a case that they know they that structure remains. YeahAnd we wanted to raise this salary, it's you know be as easy as it is to trace individual salary. Now I know that example that we are going to talk about is using dictionary. We understand that all so we want to say for what understand that we use the Force let us see. Then follow by the second letter unfollow by the next later on we are going to say two letters that are similar to the words, we are looking for. But, in a case that dictionary is not our
age in a data structure in alphabetical order, searching for a certain word in the dictionary, we will be very very difficult. You just keep opening and opening the dictionary look for different one at a different particular space of storage. That is why we say that data structure. It is very important in programming, and as well as in live interview of individual. Now, we are going to talk about using the
meter and visualize example. So we understand our data structure, money, and our movie in the computer is going to store a bicycle I didn't know we are going to use again the desktop show as an example. Now, it is a collection of elements of the same type. Amazing concert goers memory location that can only be individually your friends, by using an index for a unique identifier. Now what are we trying to talk about there. I want to believe that we already understand
on we know what an aggregate is all about. If we have been. If you have a fundamental of c++, and some programming language. You should be able to understand what are the again, is all of it. Now using an idea for a visual example of our data structure. Known using an army as example for data structure in our movie know if you, we have the face declination is an integral, which means we are experts in will be in number, because it is an integral declination. Yeah. So now, and the second. This is the data type. This database. This is a one little thing on the data type that was the play is an integral data pipe.
So we did it to be easy for us to know that our input, I can only be a bottle of normal because it is an integral. And now the next thing we need to understand is in this declination. We are number with size for it, which simply means that the elements that can be this is the size, which simply means that the elements that the size of our game, declare the account contain is really for one is can only contain of this. This
is a loop. It means it can be sighs we're telling the system to score it for value of it. Now the moment this of every element, it means this element that is created, will be stored it for value.
Now the moment this declaration is made, automatically, our system by default it's recorded a storage in our main memory discourage a memory that is created, we have value, and have my memory or this unless we have an index. Now, the value of the memory address of for storage. This is a memory address. This is a memory address. It's a mobile app based off for storage. This is 1000, and the movie addressed by default, it is an integral memo addressed by default is being a four bytes. That is where we have one is it was it was in 1000 issue on this pendant. The movie at this dilemma we have this unique name that is given, or identify number is a random value.
Yeah, it can be one Darwin's can be 2000. It's a gumball ad system determine that Oakley and by default, our integral are integral memory at this for me Tiger is for by that is that we are for value. And when you face the gates, is 1000 ways he was saying the size of again that we declare is for. So the next member we add this name will be in multiple have for. This is why we have 1004 year. And the next
one will also be in multiple form as a 1080, and the next one we also been multiple for this is where we are 1000, I told you, yeah that's is the memory at this for identifying the updates the location name And this movie is illogical memory is not a physical memory that we can see physically, but it is the logical memory, and this is how the memory declaration is taught in our computer. And now the nice thing is, if we could, if we say it's a good day for memory storage, which is 1234. And now we understand that in programming, our index is that the phone is there, so this is going to equate an index. This is an index. This is an index. It is basically an index. Now, it is going to create an index of 0123. Therefore, in the story, which is backing from Israel. And the nice thing is that after creating the movie at this.
After beating the memory address and pacing, our index for identifying each member we addressed, then this will assign a new issue of the value that is stored in this integral in this number, the issue assign it into each member we advocate. memory address we have the face, the gates. And the second memory address we are the second biggest leaders, and the thought, depending on the size of again that is the idea. Now, the face. This is our. This is our goal. Each memory, and this is, again, one one balloon,
as it is the career as an indigo, so that is another thing that you need to understand that all these are the balloon. This are the balloon asked all in four different stories at this location in our main memory. And by default, an insecure data by of thought is the four bytes of memory allocation that is a four by 81234.
So randomly, the face for a location, only memory address of four is 1000. Why are they are they named in multiple for wanting to do is do for clients do is is the APA in multiple advisors buying multiple or four for the memo we address. Now, I know that you need to understand these devalue declared in this again at 1020 3040. These value, also known as the elements. Okay. And our memory of this 1000 1004 1008 1000 minutes of your memory address, I just make an identifying name to identify each at this location of our bond. And the index besides making this visible.
Each member we address. In this represents to them, which is us, which is used to assess on to modify individual elements. You see we use this index to access each of the elements in the memory of this. Now, for you to understand in beta, we are going to speed on example. Let's assume that in this declaration of NC
go with a variable of number, which is a size of four. We didn't follow as our element. So if we told you come with a two wins with telecom computer two wins. In total computer two points. One number. Okay. With a computer to paint, I have to.
We are giving the competence of beans index of two. So definitely interested for me. If we tell the computer to win. And in this have to is this platform this face index This is one to start from 012, so definitely the results, the outputs of our index will be taking it that is what we mean by index identify are we in the index to identify each element. You know, same thing, let's say, we can also be clean. Let's see. Carter data type. And we have on August size, the August size, they say we are one of the size of five. Now we have these are the size of five, and we declared five different eliminate. A, B, C, D, and E. As an alphabetical order.
Now you need to understand that all these elements in all these elements. They're all in ascending order. It simply means that our index balloon we start from here, which is evil on one, and two, and three, four, and five. All these our index is volume. Now to assess each value on each element in this area in this area with size, five known to assess it, we need to call on to each index, we want to assess. For example, we said, we have the computer
so queens. We as the comprehensive brains developed in a way. It should win index of, let's say you have to know if it was incomplete data when did in this have to our desserts. From the Lisa declared elements and safe with index, 012, so definitely the index winter UBC. So that is the purpose of index in memory allocation, and data storage. Now, if, let's say, what is the purpose of our data which in this scenario.
If the user said that, let's say the user wanted to paint the value of. And the user is not using a data storage analysis to assess the value to paint this Dean, these, the, the computer, after stage. It was that from the beginning, sake for this interface elements of value, which is not the to go to the next one. The second value is not Dean, go to the next one, without value. It is not deep. And it's a good last one last viral. And yet, the company pays it with to identify letter D. Now, then the corporate account with the letter
that is a sign for a two wins. Now look at the beard. And they say, by default, let's assume that computer takes, let's say five seconds. It doesn't do it doesn't take up to one seconds. Well, let's say it takes up to five seconds to assess each value and enabling, that is the grid in our ally. Now, five seconds, you have to wait for another five seconds, you have to wait for another five seconds, you have to wait for another five seconds before the computer is able to assess the value you want to give us. But we need airport data social and indexing.
The competition is the need any assign index that we wanted to point to that is another four points of data structure, and we are going to end. So the last year.