3. Sorting Of Arrays
A sorted array is an array data structure in which
each element is sorted in numerical, alphabetical
or some other order and placed at equally
spaced addresses in computer memory.
In this program, we need to sort the given
array in an ascending order such that elements
will be arranged from smallest to largest.
1
3
4. “
Method of achieving sorting array and its used
4
This is achieved through two loops.
Outer loop select element to compare.
Inner loop allow us to compare element with rest of them.
1) It is used in computer science to static lookup tables.
2) To holds multiples values that have same data types.
5. Main topic slide
There’re a lots of methods to sort an array but we'll, here,
discusses Selection an Array.
“It the method to find minimum element in an
unsorted array and swap it with the element at the
beginning.”
Sort the remainder array excluding the first value.
5
6. For instance
Lets take an example to
understand the method.
• In first, take smallest element at
zero index and swap it with the
respective element.
• Secondly, bring 2nd smallest
number on index 1 and swap it.
• Bring another ascending number
further and repeat step.
• 4th element will be at last index
so, don’t need to exchange or
swap it.
7. IN TWO OR THREE COLUMNS
PSEUDO CODE
The algorithm for the
selection sort of an array.
Step 1: For i = 1 to n-1.
step 2: Set min = arr[i]
step 3: Set position = i.
step 4: For j = i+1 to n-1
repeat: if (min > arr[j])
Set min = arr[j]
Set position = j.
[end of if]
7