Purchase Solution

Quicksort : Maximum of "q^2 + (n-q-1)^2"

Not what you're looking for?

Ask Custom Question

Show that "q^2 + (n-q-1)^2" achieves a maximum over q = 0, 1, ..., n-1 when q = 0 or q = n-1.

Purchase this Solution

Solution Summary

Solution first rewrites the given equation to separate the terms involving q.

Solution Preview

Let us expand and reorganize the terms of the given equation -

q^2 + (n-q-1)^2
= q^2 + {(n-1) - q}^2
= q^2 + (n-1)^2 + q^2 - 2(n-1)q
= (n-1)^2 + 2(q^2) - 2(n-1)q
= (n-1)^2 - 2q{(n-1)-q}

Now first term is a positive ...

Purchase this Solution


Free BrainMass Quizzes
Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic Networking Questions

This quiz consists of some basic networking questions.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.