Selection Sort, Bubble Sort, & Insertion Sort

Here's an overview of introductory sorting algorithms such as selection sort, bubble sort, and insertion sort.

What is sorting?

Sorting is any process of arranging items systematically. In computer science, sorting algorithms put elements of a list in a certain order.

The most frequently used orders are numerical (according to numbers) and lexicographical (according to letters). Efficient sorting is important for optimizing the efficiency of other algorithms which require sorted input or sort given input as part of their process.

Formal Definition

A list or array is sorted in ascending order if \forall ii, such that in1i \leq n-1, A[i]A[i+1]A[i]\leq A[i+1]. Similarly, a list or array is sorted in descending order if \forall ii, such that in1i \leq n-1, A[i]A[i+1]A[i]\geq A[i+1].

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy