{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Solutions of Theory of Algorithms assignment 7.2-3

Solutions of Theory of Algorithms assignment 7.2-3 - pivot...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Solutions of Theory of Algorithms Assignment 4 Exercise 7.2-3 If the array to be sorted consists of distinct elements and already sorted in decreasing order, that will be the worst case for QuickSort algorithm. Every time the algorithm tries to subdivide the array, the result will be the whole array except one element (the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: pivot). And that unbalanced partitioning will continue during the whole iterations until the array elements finishes. Therefore it will need running time of T(n) = T(n-1) + θn , which as solved in the previous exercise is θ (n 2 )....
View Full Document

{[ snackBarMessage ]}