Waste less time on Facebook — follow Brilliant.

Sorting Algorithms

Highly-organized data can be critical for many algorithms, and often you want your data ordered from least to greatest. The art of getting your data in order is trickier than you might think!

Insertion/Bubble Sorting


What is the best time complexity of bubble sort?

What is the minimum number of swaps operations a standard insertion sort implementation performs on the following list of numbers?

\([20, 54, 37, 15, 64, 5, 65, 32, 13, 53, 23, 69, 39, 1, 24, 60, 33, 58, 63]\)

An inversion is the pair of elements \((i,j)\) in \(A[0......n]\) such that \(i<j\) and \(A[i]>A[j]\).

Given an array of \(n\) distinct elements, what would be the worst time complexity of an insertion sort algorithm if the array has at most \(n\) inversions?


Problem Loading...

Note Loading...

Set Loading...