You can go through Q50 & Q51 before this one.
Question #67: Assume that after every step of Quick Sort, the split happens in such a way that one side contains 90% of the elements and the other side contains 10%. What will be the complexity of the quick sort algorithm in such a scenario?
Options:
- O(n)
- O(n3)
- O(n2)
- O(n log(n))
Solution: Although this looks like a bad split, but still, quick sort would run in O(n log(n)) time. Following will be the recursive tree that will be formed.
In fact, any constant split (e.g. 99:1) would yield the same time complexity as the normal case, making option 4th the correct answer.
