Divide and Conquer Algorithms

We'll cover the following

The two sorting algorithms we've seen so far, selection sort and insertion sort, have worst-case running times of Θ(n2)\Theta(n^2). When the size of the input array is large, these algorithms can take a long time to run. In this tutorial and the next one, we'll see two other sorting algorithms, merge sort and quicksort, whose running times ar better. In particular, merge sort runs in Θ(nlogn)\Theta(n \log n) time in all cases, and quicksort runs in Θ(nlogn)\Theta(n \log n) time in the best case and on average, though its worst-case running time is Θ(n2).\Theta(n^2).Here's a table of these four sorting algorithms and their running times:

Create a free account to access the full course.

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