menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Data Science News

>

Selection Sorts
source image

Dev

1M

read

118

img
dot

Image Credit: Dev

Selection Sorts

  • Selection Sort is a comparison-based algorithm that swaps the minimum element in place to achieve a time complexity of O(n^2) and space complexity of O(1).
  • Steps to perform Selection Sort: Start with the first element as the minimum. Compare this element to the rest of the elements to find the smallest. Swap the smallest element with the first element. Move to the next element and repeat until the list is sorted.
  • Heap Sort is a comparison-based sorting algorithm that uses a binary heap data structure. It is efficient and consistent.
  • Steps to perform Heap Sort: Build a max heap from the input data. The largest element is swapped with the last element of the heap and removed from the heap. Heapify the root of the heap. Repeat the process until all elements are sorted.

Read Full Article

like

7 Likes

For uninterrupted reading, download the app