Thanks for the replies everyone, im still totally confused, lets talk about selection sort. I understand that one of the feature of selection sort is to find out the lowest value of the array and swap it with the first element of the unsorted part. However I can't find any part of the algorithm, can someone please point that out. Also after the first swap, I dont know how the algorithm contiune on to find the 2nd lowest value, I have read though all availiable texts I got, but still very very confused :S Can someone please answer my question, I will appreciate it.
Below is the algorithm:
BEGIN SelectionSort
Pass = 1
WHILE Pass < Number of Items
Count = Pass + 1
Minimum = Pass
WHILE Count <= Number of Items
IF Item(Count) < Item(Minimum) THEN
Minimum = Count
ENDIF
Count = Count + 1
ENDWHILE
Swap Item(Minimum) with Item(Pass)
Pass = Pass + 1
ENDWHILE
END SelectionSort
As i said before, i can't identify the bit which find the lowest value, as well as after it finds the 1st lowest value, how does it continue to find the 2nd value and so on. Thanks in advance