For the obvious reasons. For the obvious reasons. Here's the corresponding interface. The elements can be compared. No elements are added or deleted.
Selection sort is among the simpler and more natural methods for sorting.
In this sorting algorithm, you segment the array into two subparts, a sorted part and an unsorted part. You repeatedly find the largest of the unsorted elements, and put that at the beginning of the sorted part. This continues until there are no unsorted elements. Here's my recursive version of selection sort. Initially, each element is null.