- Published on
The Algorithm Design Manual (3rd) Exercise Solution 'E4-35'
Table of Contents
Introduction
This series is my solutions for algorithm exercises in'The Algorithm Design Manual' 3rd edition.
It's my solutions, not model answers, so if you find some mistakes or more sophisticated solutions, please post in comment area below.
Repository
Exercise 4-35
Question
Let be an array such that the first elements are already sorted (though we know nothing about the remaining elements). Give an algorithm that sorts A in substantially better than steps.
Solution
First We sort elements that's not yet sorted. This costs .
Then we merge already sorted part and previously sorted elements using Mergesort-like combination algorithm. This costs .
dominates , so n dominates .
The overall time complexity is: