Data Structure Presenation2

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

‫لر ّح ٰم ِن ۤال َر ًٗ‬

‫حیم‬ ‫س ِم ہللاِ ۤا َ‬
‫بِ ّ‬
ASPIRE GROUP OF COLLEGES PHALIA

Assalam-o-
Aalikum
Mehmona Zainab

BS-IT
MERGE SORT
d . i n
s
u hme
n l y i t
RT o m
o
m alg o r
o or
SO i s c u e r t w e
q to e s
ch on
RGE , w h i
a n d c
b l em
i n
u n t i l t h
o t h e

ME g a
r i th m
i v i d e
lgo is a d wn a ed ty olutio origi s
t o
p
t
ro
p e
s
, n
e
s t
n a
e
l
ti n o r d e la e t h a l v
s or ge S aking or r ly. Th n to a l h
is a e r r e e e c t ti o e q u
r t e . M ly b s am d i r so lu to
o
S cien c i ve e e d a y i n
rg e s u r s t h o l v i v e r r a
Me puter y rec ms of to be s ed to g the a
o m s b b l e h b i n d e s er .
c o rk p r o o u g o m i v i a n n
w - n c d
It e sub ple e then t first rted m
o r si m are o r a s o
m me m s g e S in
c o l e r m
be prob o Me s the
u b - . S bine
s l e m o m
o b c
pr then
DEVELOPERS

It is developed by JOHN VON NEUMANIN1945.A


detailed description and analysis of bottom-up merge
sort appeared in a report by GOLDSTINE and VON
NEUMANN as early as 1948.
Merge sort Algorithm

ꙮ If it is only one element in the list it is already sorted,


return.
ꙮ Divide the list recursively into two halves until it can no
more be divided.
ꙮ Merge the smaller lists into new list in sorted order.
ꙮ Below is an image of an array, which needs to be
sorted. We will use Merge Sort Algorithm, to sort this
array:
EXAMPLE OF MERGE SORT

Array
6 5 3 1 8 7 2 4

STEP# 01 6 5 3 1 8 7 2 4
6 5 3 1 8 7 2 4
STEP # 02

6 5 3 1 8 7 2 4
STEP # 03

5 6 1 3 7 8 2 4
STEP # 04
1 3 5 6 2 4 7 8
STEP # 05

1 2 3 4 5 6 7 8
STEP # 06 FINAL
THANK
YOU

Submitted by:
PROF. SHERAZ SIKANDER

You might also like