Algo-Lecture#4 divide and conquer approach-23-NOV-11.ppt
arslanahmadkhan295
4 views
56 slides
Oct 25, 2025
Slide 1 of 56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
About This Presentation
in this presentation we have explained the concept of divide and conquer approach
Size: 7.47 MB
Language: en
Added: Oct 25, 2025
Slides: 56 pages
Slide Content
128
64
32
16
8
4
2
1
Stable Sorting
Stable sorting algorithms
maintain the relative
order of records with equal keys (i.e.
values).
That is, a sorting algorithm is
stable
if whenever
there are two records
R
and
S
with the same key
and with
R
appearing before
S
in the original
list,
R
will appear before
S
in the sorted list.
Some examples of stable sorting algorithms
are
bubble sort and
mergesort( although the
stability of
mergesort
is dependent upon how it is implemented).
Some example of
unstable
sorting algorithms
are
heapsort
and quicksort(quick
sort can
be made
stable,
but
then it won't be quicky any more).
In-Place
Algorithm
An
in-place algorithm is an algorithm that does not need an
extra
space and produces an output in the same memory
that
contains the data by transforming the input ‘in-place’.
However,
a small constant extra space used for variables is
allowed.