Solutions of Theory of Algorithms assignment 7.2-3

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

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

This note was uploaded on 11/09/2010 for the course CS 11841 taught by Professor Dr.ayman during the Spring '09 term at Alexandria University.

Ask a homework question - tutors are online