selection sort

39 examples (0.03 sec)
  • Info In computer science, selection sort is a sorting algorithm, specifically an in-place comparison sort.
  • Indeed, selection sort does one pass through the remaining items for each item moved.
  • Selection sort can also be used on list structures that make add and remove efficient, such as a linked list.
  • Selection sort is an in-place comparison sort.
  • Calculations show that insertion sort will usually perform about half as many comparisons as selection sort.
  • Selection sort can be implemented as a stable sort.
  • As in selection sort, after k passes through the array, the first k elements are in sorted order.
  • Insertion sort is very similar to selection sort.
  • Heapsort is a much more efficient version of selection sort.
  • A simple example of selection by partial sorting is to use the partial selection sort.
  • Selection sort is noted for its simplicity, and also has performance advantages over more complicated algorithms in certain situations.
  • It improves upon the naive selection sort by using a priority queue to find the next element in the sort.
  • Selection sort is noted for its simplicity, and it has performance advantages over more complicated algorithms in certain situations, particularly where auxiliary memory is limited.
  • For selection sort these are the k smallest elements, while in insertion sort they are whatever the first k elements were in the unsorted array.
  • For this reason selection sort may be preferable in cases where writing to memory is significantly more expensive than reading, such as with EEPROM or flash memory.
  • If the input array is reverse-sorted, insertion sort performs as many comparisons as selection sort.
  • Selection sort is not difficult to analyze compared to other sorting algorithms since none of the loops depend on the data in the array.
  • A bidirectional variant of selection sort, called cocktail sort, is an algorithm which finds both the minimum and maximum values in the list in every pass.
  • Thus, if on average there are more than two items with the same value, bingo sort can be expected to be faster because it executes the inner loop fewer times than selection sort.
  • Two of the simplest sorts are insertion sort and selection sort, both of which are efficient on small data, due to low overhead, but not efficient on large data.
  • Next »