Sorting Basics
Sorting Basics
sorting
Min cost to delete elements
count of noble elements
sorting Algo
selection and Insertion sort
sorting arrangement of data in a
parameter
I 13 9 8 12
t sorted in asc order
I t
count
of 1 I f based on count
factors of factors
easier
why sorting Searching becomes
Analysis
Readability
TEE I
CAN 43
delete 4 4 2 1 7
delete 2 2 41 3
delete 1 I
Ans 11
a A I
delete 6 4 6 1 11
delete 4 4 I 5
delete 1 I L
Ans y
6 4 I
Q CH X X 3
delete 5 3 5 1 1 37 6
delete 3 3 I C 37 1
delete 1 I C 37 2
delete 3
ans
10 2
10 2 2 10
delete 10 10 2 delete 2 2410
delete 2 2 delete
a
g
ca b das
Delete a a tb ctd
Delete b b ctd
Delete c c d
such a
I
a
i
cat
i 3
I 2
2 4 6
lofty
H asr C n
int cost D
On
Ci it
for o ich
cost 1 arr Ci
1
return cost
TC Ochlogn
Sc O sorting
guy on algo space
Distinct
N G
ans 3
cant I I to Ig
ans i
ant to t I I
elem count of smaller
Yo
I
odor to
BE For
every element check it is noble
o d
int ans
48 I Cnt t
b
if CA Ci ant ans t
7
Cnt CO i I I Y O TX i
2 5 0 3 3 6 33
to
C 3 Co Ers
ant
t t t t
sort Cary
nd g n
int ans 0
for ci o ith II
Cnt i
I if Aci Cnt Tc
ans t Ochlogn
se Ocsorting
algo
return ans
20
10
ans 3
ant
f at to f
am to s It
ans 5
ant htt s to b
ans 3
Et
cent i
Let's to
find those elements
try
where i cent
l ich
for Ci int
if Carr Ci ant
ans tt
y
g
cant 07227774
ans 0 43
Selection sort
Line
117AM
All students are in unassanged queue
Search for shortest student
in the list of arranged students
Keep doing process till whole
class is done
in Search
0 0 3 51g
i i 3
121615142
2 2 3
1311415162
3 3 3
20 4 5 63
E ma
fitfiitiity