Data structure

소바·2022년 8월 19일
0

why do we have different types of data structures?


you can think of data structures as any sort of compartment or container.
A data structure is simply a file cabinet of different types.
Each one of these containers are specific for its own thing, and that's what data structure really is.
It's a way for us to organize data so that we can go into the backpack and retrieve that data really easily.

Well, if we scroll through wikipedia, we see a ton of data structures and this is going to look overwhelming.
You probably only have about five or six data structures that are really, really important.

Why don't we just use the same data structure for all of our needs?
Well, each data structure has its own strengths and its own weaknesses.

For example,
some data structures are very fast at storing and recording(=registration) data, but they are slow at searching(access) through data and retrieving(=bring back) it.

Other data structures are the exact opposite.
They are slow at storing data, but fast at access and retrieving it.

So each type of data structure can be useful for different reasons.
That is physically what data structures are in computer science, and we will be learning how to code

why knowing the Data structure is a useful skill to have?

Well, learning how to implement data structures in your programming has a lot of value in it for many different reasons.

1. One reason is that using data structures correctly in your programming can highly affect how fast performing and efficiently your applications run.

So, for example, if you are constantly storing data but you are not going to be retrieving it that much.

For example, let's say that you work at Twitter and you are in charge of storing really old tweets in a database,
then in this case you would want a data structure like a linked list, which is really fast at recording a lot of data, even though it's not the fastest at retrieving that data.

On the other hand, if you want to store very recent tweets in a way that allows a lot of people to view them very quickly, you are going to want to use a data structure that can access data quickly, such as a hash table.

It's up to purpose.

So as you can see, using the correct data structures in your programming can be very crucial for making your applications run smoothly, quickly and efficiently.

2. it's linked with understanding JS algorithm.

Another reason it really helps you to nail down(= make something definite) exactly JavaScript algorithms and a lot of important concepts that are pretty crucial to having all thorough understanding of programming and javascript.

Reason why we should undertanding data sturcture
1. EQS -> making app run effirciently & smoothly & quickly by using the correct data structure
2. it's linked with JS algorithm

In order to truly understand the value of data structures, we have to go deep down into the way computer works.
In order for a computer to run code, it needs to keep track of things like variables, like numbers, strings, array.

These variables are stored in what we call random access, memory or RAM for short.

Google

But let me give you an example as if we're using Google. When we run Google Chrome, for example, a browser.
Now, in order for our computer to run Google Chrome, we run the CPU for it to do so. Now when a variable is declared in, let's say, a script to run Google Chrome, it's going to hold that in memory in our random access memory.
But once we turn off or close Google Chrome, we want to be able to reopen it, right?
Well, that's what we do when we save an application on our computer, we save it to storage so that next time we open up Google Chrome. The CPU is going to grab the program from the storage so that it can use it again.

And for Google Chrome to run fast and run smaller scripts, it's going to keep that information and random access memory.

So you can think of RAM in the computer as a massive storage area, kind of like a data structure, Well, this massive storage area has shelves that are numbered.

We call these address or addresses, and it's a really, really big shelf that holds a lot of information and it allows us to run programs.

Now, each of these shelves holds what we call eight bits or numbers.
Each one of these numbers is a bit.
And a bit is a tiny electrical switch that can be turned on or off.
But instead of calling it on or off, we call it one or zero and eight bits is called a byte. Each shelf has one byte Of storage.

And the CPU is connected to something called a memory controller and a memory controller does the actual reading of this memory as well as writing this memory, because sometimes the shelf might be blank and doesn't have anything.

Now this direct connection to the CPU is important because the CPU asks the RAM, Hey, what's in shelf number zero?
And the memory controller actually has connections individually to all of these shelves.
Again, that's really important because it means that we can access the zero shelf and immediately access the seven shelf or 10,781 shelf without having to climb down or step down. That's what the name random access memory means.
We can access memory really fast because we have these connections any shelf we want. We just need to know which shelf we're looking for.

cpu cache

And to further optimize this, our computers also have what we call a CPU cache, where the CPU has a tiny, tiny memory, where it stores a copy of stuff that is really, really recent.

data structure?

Data structures are remember ways for us to store information.

For example, if we want to store a variable A equals one, well, in our modern computers, usually we represent integers.
That is this block size of RAM.

profile
소바보이

1개의 댓글

comment-user-thumbnail
2023년 5월 31일

It is essential to seek medical advice to determine the underlying cause of the condition and to receive proper treatment. Painkillers should only be used as a temporary measure while waiting for the results of other treatments. https://immediatereliefforsciaticapain.com/

답글 달기