Sie sind auf Seite 1von 7

...

Y
lltCF SFASTlAt
S2 HCA
R0ll t0.36
S0RTlt6
W Sorting means arranging a set oI data in some
order . There are diIIerent methods that are
used to sort the data in ascending or
descending order .
SFlFCTl0t S0RT w0RKS AS...
. Find the minimum value in the list
2. Swap it with the value in the Iirst position
3. Repeat the steps above Ior the remainder oI
the list (starting at the second position and
advancing each time)
Al60RlTHH
Step Start
Step 2ntilize an array A and temp-0
Step 3Read the limit to n
Step 4!rint "Enter the elements"
Ior i0 to 'n' do
Read the values to A|i|
Step 5Ior i0 to n- do
Ior ji to n do
iI(A|i|~A|j|)then
TempA|i|
A|i|A|j|
A|j|Temp
Step 6!rint 'The sorted Elements'
Ior i0 to n do
!rint A|i|
Step 7Stop
C0HPlFXlTY
A|gor|thm Worst case Average case 8est case
SelecLlon sorL C(
2
) C(
2
) C(
2
)
%,., ....