100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Presentación

Presentation Data structure and algorithms

Puntuación
-
Vendido
-
Páginas
35
Subido en
06-03-2023
Escrito en
2022/2023

Presentation Data structure and algorithms

Institución
Grado











Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Grado

Información del documento

Subido en
6 de marzo de 2023
Número de páginas
35
Escrito en
2022/2023
Tipo
Presentación
Personaje
Desconocido

Temas

Vista previa del contenido

~_ DATA STRUCTURE AND
ALGORITHMS __________~




Introduction to Data Structures & Algorithms

should be able to use it in your work or in your projects or in your courses or in your projects
that you are doing in the future or in your work that you are doing right now so if you want to
use something then you should be able to use it in your work or in your projects or in your
courses or in your future work or in your projects that you are doing right now . So data
structures and algorithms are things that help us in our work or in our projects or in our
courses or in our future projects or in our work or in our projects that we are doing right now
so if you want to use something then you should be able to use it in your work or in your
projects or in your courses or in your future work or in your projects that you are doing right
nowwater in a pot and you put the tea bag in the cup and you make the coffee Now what is
the difference between data structures and algorithms? Algorithms are specific steps that
need to be taken in order to solve a problem.I have been in the industry for a long time now
and I have seen a lot of people learning C , C++ and when they start to learn it they get very
lost & confused & they don't know what they are doing & they don't know how to use the
language properly & eventually they stop learning it & they end up becoming a beginner
again & that is not good for the industry & it is not good for the learners either so I would say
learn C , C++ & don't get lost in the language learning process

a break for a while I understand that you are very busy for the next few days and I
understand that you are very busy for the next few weeks and I understand that you have a
lot of questions so I 'll just stop now and I 'll come back to you in a few days and we will start
the next video where we will talk about algorithms and data structures and then we will talk
about interviews and then finally we will talk about the final exam and you can ask me any
questions that you have in your mind so that 's all for now I 'll come back to you in a few
days and we will start the next videowhat is the data structure of chrome so now we see that
the data structure is called RAM so the data structure of a database is called RAM because
when the program starts it will load into RAM the data structure of the database which is
called RAM . And then you will get to hear this and it is asked in the interviews, "tell me, what
is this?" So now let's understand database, data warehouse, and big data here we have
understood the data structure that when your program starts in RAM, it will load into the
random access memory.I want to keep the data in a different database so what I have to do
is I have to create a new database and I have to name it `` legacyData '' I have to create a
new table in that database and I have to add the following column in the table `` Birthday `` I
have to add the following column in the table `` Year `` Now I have to run the program and I
will get the following result in the console `` Facebook 2020 `` Facebook 2021 `` Facebook
2009 `` `` Facebook 2020 `` Facebook 2021 `` Facebook 2009 `` `` Facebook 2009 `` You
retrieve and read the data from hard disk drive and update it.

know these three terms because big data is what we are talking about here .memory
location where the C program stores the data that is to be processed next and the heap is a
memory location where the C program stores the data that is to be processed next but the
data that is to be processed next is not always stored in the same location as the data that is

,to be processed next because the C program can keep data in different memory locations
depending on the situation and this is why it is important for you to understand the stack and
heap because you will be able to understand the C program better and be able to ask more
questions on the C program. Alright ... I 'm talking about C program that 's why I say that you
get a good picture of memory with the help of C programming therefore , data structures and
algorithms is best learned from C and C++ Now here I am dividing it into segments so there
is thing called code segment let 's say this is my code let 's say there is a code with the
name `` harry.c '' now this code will be first loaded into my main memory I told you what is
the first thing that happens ?then it will come to this line it will come to fun1 ( ) , it will execute
fun1 ( ) . fun2 ( ) is calling inside fun1 ( ) now the variables that I had created inside it will be
created here let 's say I have created `` k '' & `` l '' let me write here : initialize k and l and
after that I 'm calling fun2 ( ) so as soon as fun2 ( ) will be called it will say to fun1 ( ) that you
wait for a while , I call fun2 ( ) and be back by fetching the value whatever it will return fun1 (
) replied that you go and get it call fun2 ( ) and get its value .

me where do I give the milk to the milkman because the pointer will store the address of the
malloced memory so the milkman will get the milk from the pointer and the pointer will stay
there until you return the function or until you delete it.it will say to fun1 ( ) that you 're
coming back and now you can start your execution again . If anyone asks you this question,
that why heap is used, it can also be done from stack. So that thing is done here with the
help of dynamic memory because when does the stack of a function end it ends when the
function is returned. I just come back with the value you just wait here. You go and get it and
then what will happen, fun function will be called.




Time Complexity and Big O Notation.

So the input size didn't increase and the runtime of the algorithms didn't increase either .No,
it doesn't depend on the size of the input. When we ask questions like as the input will
increase, Then the runtime will change as per what? And after that Now you will go to
aunty's house You will be treated. Consider there are different routes to come and go.

is the algorithm that runs in constant time. K1 n to the power 0+k2+k3+k4 This time is
required in algo 2. The sentence is: Run time of it, there are some things that we will recite.
Because we won't constantly use our brains again and again, as we see Big O of 1 it is
constant. Now, come here and listen to another story. If we do an analysis of the first
algorithm, If I do T algo1 Then what will happen here? And along with consider that game is
of L3 kb. If the game is of N kb then how much time will you need? The sentence is: Run
time of it, there are some things that we will recite. There are polynomial algorithms and
there are exponential algorithms and there are logarithmic algorithms and there are
exponential functions and there are logarithmic functions. There are also algorithms that are
not linear in time.




Asymptotic Notations: Big O, Big Omega and Big Theta Explained.

,We 'll talk a little bit about asymptotic notation. we talked about order. We talked about
ordering. We have primarily 3 types of asymptic notation big O, big Theta (Θ ) and big
Omega (Ω) big O is represented by capital (O), which is in our English. Big O is set to be O (
g ( n ) ) if and only if there exist a constant ( c ) and a constant n -node such that 0 ≤ f ( n) ≤
cg (n) is O (g (N) If you watch this video completely then I guarantee that you will understand
these three notations. Mathematically, mathematically this function can be anything. When
we do analysis of algorithms comparing any 2 algorithms then f ( n ) will be time and what is
n , it 's input ok , size of input. G ( n) is your function which will come inside the big O. O ( n²)
is Anything Can Be Algorithm it is g (n) that will be here and which is your algorithm. If you
guys can find any such constant ( C ) and ( n ) -node , then f ( n) is O ( g ( n)" This is the
mathematical definition of big O. If you ca n't find it then its is not f (n ) is O. This question is
its own truth , it has validity , it will remain valid.




Best Case, Worst Case and Average Case Analysis of an Algorithm

To define an algorithm, To define the events in the life of an algorithm , We have , Best Case
Worst Case and Expected Case. And along with that, I 've packed one more thing into this
video : The definition of Log. If you watch this video till the end , Then you will find out what
this 'Log ' really is. 1. . . 5. . . 7. . . 9 and 24 are the numbers in it; They 're in ascending order
, You can see for yourself. If you know even a bit of maths, You 'll know that it is in an
ascending order. Now what I say is that I 'll give a number : 'A' And I 'd like you to tell me If
this number exists within the array , or not. Suppose the value of A is 8. So what will be your
answer ? Yes. Meaning 1. If A is. . . Sorry, your answer will be no , because it is n't there. If
the value is 9, What will the answer be ? Your answer will Algo 1 is a simple person. It does
n't have much of a brain. It is comparing it with all the numbers. Is this the best way to do this
work ? Obviously not. Because Algo. 1 is lucky , He will get A=1. It will tell us in the first
comparison itself. In one comparison only.
If Algo 1 is in luck, The time needed is ' k ' - T=k. This means that it does n't depend on 'n '.
Take a 10-element array, take a single element array or take a 10,000 element array. It only
has to make one comparison because it is only searching for the first element in the array.
Now, AlGo 1 's luck is bad. Till now, he was fortunate ; But now he 's not so lucky anymore.
Average Case complexity is equal to. . . the sum of the run time for the total number of
possibilities. The O ( Sum of all possible run times divided by the number of possibility ) is O
( n ) The average case complexity is the sum. Average Case is equal. to. . . The sum of all.
possible run. times divided. by the total. number of possible run time. So for an array size of
5, We saw six cases. 't ' ; I 'll calculate ' O ' later. n+1 If 'n ' is the size of the array , Then
there is 'n+1 '' number of possibilities. 'n' possibilities is when there is 1st element, 2nd
element, 3rd element, 4th element, 5th element and 6th element. If the element is here, How
many comparisons will it have to make ? It will have to do. . . 1. . . 2. . . 3 comparisons. I 've
taken ' k ' as common out of everything. I removed this because this is different. And this I
have added separately.

AP is Arithmetic Progression and GP is a geometric progression. AP is used in 'O ' a lot. APs
are made as well as GPs sometimes. When there are questions on 'O' APs and GPs are
used in the answers to questions on O. The formula of Average Case Complexity is All

, possible run times divided by the total number of possibilities. The Average Case Time is not
generally asked for a unique algorithm. It can be asked for this type of algorithm , A simple
algorithm that compares all of these. So what is the Average Case. Complexity ? O ( n ).
Algo 1 was making 'n ' comparisons. Now we 'll see how many comparisons this will make.
Algo 2 is a cunning person. It will match the first and last element and match it first. It made
one comparison For a size of 10 array , As well as for an array of size 100. It is making the
same comparison for all sizes of array.

The midpoint between 1 and 100 will be 50. Then you will discard this entire array that has
elements greater than 50. If there are an even number of elements here, there are 2-2-4,2-6
elements. So the midpoint can be both 7 or 9. So I can take either of them as midpoint. You
will keep halving an array until it gets over; In the worst case, you will find the element. You
can halve 8 once, and it will become 4. 8 has become 3. How many times can you divide 16
? You can divide 16 once, twice, twice and four times. How will you divide 1 ? You ca n't
halve 1 ? How many comparisons will you make ? For 100 elements, how many
comparisons are you making ? You'll make an estimated, 5-6-7 comparisons. So I told you a
very good definition of 'Log '. Nobody told me this , And most probably nobody will tell you
either. This definition that I have told you in this course , You would n't have got it very easily.
And now you have it. You must appreciate the definition of Log.




How to Calculate Time Complexity of an Algorithm + Solved Questions


Before Solving Some Questions of Time Complexity I will tell you some tricks to get rid of
time complexity. After that we will do some set of questions. which will make you a very good
grasp in such questions. due to the time complexity of any algorithm when you have to find it
so what is the first step that you do and at the same time how to approach this problem. In
this way, whatever instructions are going on here , it is taking almost ( k ) time. We believe
that these operations are all (k ) time consuming This for loop , that is , how much time is
being taken for this fragment It seems ( kn ) , okay So before this ( int i ) would have been
written here, ( int k=0 ) would be written here. The third technique that I want to tell you is
this : That break the code into fragments. The first fragment turned out to be this one , with a
little bit of initialization. It took constant time because it is not such that if the value of ( n )
increases, then its time will increases.
I will go for ( n = 100 ) to determine whether i will be going for n = 1000. I will accept it in (
k4) and ( n * k4 ) I will do it in k4 and (n* k4), and it will happen O (n²) If you do it ( k=0 ) , ( k
< n ) and if you look at it , it will come out O ( n²) Okay, it will not (N²) ok remember you this
thing. There will be some code on it which will take ( k1 ) Now I have become so smart, by
doing questions , and you will be done too That (k1) it is will going to be non-dominant , if
constant is being added then we will remove it. So once the value of ( i ) will be zero (0) and
then the value of ( j ) will run for. Then ( j=1) will become Then ( 0,2) Then (i=0 , and j=0 ) will
then run for Okay. The value of ( i ) will be zero ( 0 ) for ( n ) times running then the value of
(i ) will become ( 1 ) , it will run again (n ) times then it will go on till n. When ( n) is running
out, watch carefully , watch very closely. Then later I will ask the question, then I am telling if
$7.99
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
adnankhan3

Conoce al vendedor

Seller avatar
adnankhan3 London university
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
0
Miembro desde
2 año
Número de seguidores
0
Documentos
1
Última venta
-

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes