Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Samenvatting

Summary IN ORGANISED WAY

Beoordeling
-
Verkocht
1
Pagina's
55
Geüpload op
16-05-2023
Geschreven in
2022/2023

The document on DSA (Data Structures and Algorithms) is a comprehensive guide that covers the fundamental concepts, techniques, and implementations of data structures and algorithms. It provides an overview of various data structures such as arrays, linked lists, stacks, queues, trees, and graphs, along with their associated operations and complexities. The document also explains essential algorithms like sorting, searching, graph traversal, and dynamic programming, emphasizing their efficiency and trade-offs. Additionally, it may include practical examples, code snippets, and problem-solving strategies to help readers understand and apply the concepts effectively.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

Bubble Sort Program in C
CodeWithHarry
The code in Bubble Sort in C language is so easy that after
this video, you 'll say it was super easy and you'll have a lot
of fun. I use C language because most people understand it.
Those who know either C or C++ understand. They are
similar languages so you wo n't face an issue. We 'll add
two for loops here. It 'll work from i = 0 to n. In every pass,
we compared 2 elements like 0 and 1 in each pass. We
should 've replaced them if they were not in place but we
did n't because they were in place. We had to see 11 and 9 ,
we had to replace them. 9 is smaller than 11 , so it 'll come
first. If I compare 11 and 2 , I 'll have to replace it. Then 2
and 3 in the next new array and keep swapping. So till
where should passes run ? It 's a mystery. The comparisons
fit into a math formula, n-1-i. This for loop is for number of
passes and this is for comparison in each pass. The
comparisons in each. pass will be in this for loop. The value
of j will be 1, it 'll be between 1 and 2. Is 11 greater than
2 ? Yes. Interchange 11 and 11 and swap them.
If in our comparison , the first element is greater than the
next element, we 'll have to swap them. We only have to do
this and our array will be sorted. Everything else will be
handled automatically because what are we doing ? We are
running n-1 passes and we 're doing this for every pass.
Bubble Sort is just this easy. After every pass, I 'll make a
variable, isSorted, which means whether or not it 's sorted.
If it fails every time, that means the array is sorted. Even if
this happens in pass 2 or 3, we 'll want it to stop as soon as
if does n't apply to any pass , we want the sorting process to
stop. So how many passes will work in this here ? A single
pass will do. If the array is already sorted, it takes only one

,pass to sort it. If it 's not sorted, if I comment out and
uncomment, then you can see that it takes 5 passes to sort.
If there 's no swapping in the first pass itself, that means the
array 's already sorted. If I do n't have to swap anything,
what does that mean that the array's elements are sorted. I
'm making isSorted value 1 after every pass. I only care
about sorting my array within minimum time , I should be
happy.

,Insertion Sort Algorithm in Hindi
CodeWithHarry
I will tell you Insertion sort in intuitive way in this video that it
will be difficult for you to not understand Insertion Sort. I will
challenge you that. Now listen carefully to what I am saying
Here are some people in a line like and assembly line of our
school. And many other lines. Lalita found her place in this
array. Lalita kept this array sorted. The array was sorted
before too but Lalita captured position such a way that now
the array sorted too. Lalitan said that if he had more money
than Lalita then he too would be behind Lalita. Insertion sort
algorithm uses Insertion Sort algorithm to sort an array of
elements. The elements in array are 7, 2, 91, 77 and 91. We
need to insert an arbitrary element in a sorted array. So 91
will go to 7 and ask Are you bigger than me ? 7 will say I 'm
smaller. 91 will ask 77 whether you are greater or smaller ? It
is bigger so 77 will ask it to shift one step.
Insertion Sort in C Language (With
Explanation)
CodeWithHarry
After watching this video, I guarantee you to teach coding of
insertion sort. And your responsiblity is to watch this video to
understand insertion sort properly. In this video we 'll be
doing only insertion sort and nothing else. In insertion sort
we assume that the 1st element is sorted. And that is a
sorted array, and other side array is not sorted. Now when we
will insert 2 in this array, what will happen ? 2 will come

, here , but how ? Let me show you how. We have not made
insertion sort function. So I 'll write it as , printArray And I
have written , A It will print the array A. So here , there is
some problem , that is I have to also write n here. Now when
I'll run it it will print all the elements. No surprises but so
ever, 12 , 54 , 65 , 7 , 23 , 9 and 9. Loop for passes means 1st
pass, 2nd pass, 3rd pass, and 1th pass. If I am counting from 1
to 1 it will go till n - 1 I can write < = n 1 or < n < n. How many
time I 'll run it , how many passes are there , its n-1 So , if I'm
counting from index 1 I am going till last index. And
completing all the passes. Loop will work here.


Key will be inserted one by one in left array. First 54 then 65,
7, 23 , 9 and 65 are inserted. If A [ j ] means 65 is < key then
okay I will stop. If this condition will be false like in this case it
is true so it will go inside while loop. If false, then it will stay
here. Then if I do n't add one more condition here Then A will
start comparing 7 to -1 And A [ -1 ] is nothing. I will revise it
once more in the video. Sorting algorithm can be easily
understood in the whole DSA. In fact it is something which
you can explain to a layman. to anyone in this world. The
code is very small but Understanding is simple to just like
code. I wo n't say it is difficult to understand. I do n't know
why people make sorting algorithms so complicated. So , I
will run this code step by step and after that I will show you
sorting here. So , you can see here I have written elements
like this. and I am writing nine as 09 so that my index will be

Geschreven voor

Vak

Documentinformatie

Geüpload op
16 mei 2023
Aantal pagina's
55
Geschreven in
2022/2023
Type
SAMENVATTING

Onderwerpen

$8.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
abdullahkhan7

Maak kennis met de verkoper

Seller avatar
abdullahkhan7 SINHGAD ACADEMY OF ENGINEERING
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
1
Lid sinds
2 jaar
Aantal volgers
1
Documenten
9
Laatst verkocht
2 jaar geleden

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen