Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary Merge Sort

Rating
-
Sold
-
Pages
2
Uploaded on
25-03-2023
Written in
2022/2023

Merge sort is explained

Institution
Course

Content preview

Mergesort is a sorting technique also works on divide and conquer
technique as in quicksort technique. In this video I discuss with you
the working of this merge sort with help of an example. The first
step is dividing the given list into sub lists and the second step is
merging of those sub lists. C merge sort is a function merge suit is
array we are going to pass lower bound and upper bound this is
lower bound. If two elements are there then then you're going to
divide that particular list into sub lists. Then each each sub list is
having only one element and that is the condition you have to stop
dividing you will keep on dividing the sub list. The main thing is you
have to write down the code for this merge function that this
backbone of the merge function how we are going to merge these
arrays. The code is a recursion call to left part n to right part so this
is a call to a recursively call.

Midpoint is midpoint fine so here we call merge sort 0 - middle
element is 0 because 0 plus 1 that is 1 1 divided by 2 is 0 and then
again merge sort 1 to 1 and again we are going to call merge
methadone 0 metal point is lower bound is 0. This is the recursive
tree now how this is going to be called see first of all massive of 0 to
8 here we have first cold would we do this function 0 to 4 again for
first sorting of this one. We are going to call merge 5 then 5 and
then 6 fine lower bound is 5 mid is also 5 and upper bound is six
now seven 8 7 is less than this it yes this condition is true. We are
going to merge these list with its adjacent lest only and when you're
going to draw this recursion tree then you come to know that how
we are. merging these sub lists will be merged this and this that is
why I am saying you can not merge this 15 with 8 or 15 with 24 but
it 's not like that if this 5 and 15 is 1 list and you are merging this
with 8 no.

I am going to discuss with you how this merge function is going to
be executed. We are going to compare the first element of these
sub lists fifteen and five which one is less five is less. then here six
to six then merging would be done then again back to seven to
eight then this one this one and then finally merging of these lists
fine. Time complexity for this merging function would be what theta
M plus in M is number of elements in one sorted sub list and is
number in another sorted sub lists. When you are going to add these
elements into this one then how many elements would be there in
this key in this sub list M plus n. If you write down the code for this

Written for

Course

Document information

Uploaded on
March 25, 2023
Number of pages
2
Written in
2022/2023
Type
SUMMARY

Subjects

$5.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
anishk

Get to know the seller

Seller avatar
anishk Manipal Univeraity
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions