Crash Course: Data Structures

Selection Sort

Ashna Jain
Jun 16, 2021

Introduction

Selection Sort is an algorithm that sorts an unordered array into ascending order by repeatedly comparing elements to find the next minimum.

While sorting, the algorithm maintains 2 parts of the array: a sorted part, and an unosrted part. In every iteration of selection sort, the minimum element from the unsorted subarray is picked and moved to the sorted subarray.

Big-O Runtime

The Big-O runtime of Selection Sort is O(N²).

Coding Implementation

Itervative

Recursive

--

--

No responses yet