Selection sort

来源:互联网 发布:windows 激活信息 编辑:程序博客网 时间:2024/05/22 14:52

Consider sorting n numbers stored in array A by first finding the smallest element of A and exchanging it with the element in A[1]. Then find the second smallest element of A, and exchange it with A[2]. Continue in this manner for the first n - 1 elements of A.This is how selection sort algorithm works, which costs O(n2).

原创粉丝点击