Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

7. In this lecture note, the quicksort algorithm is given. (a) Write the pseudocode for quicksort. (Or, a source code program in Java programming language.

image text in transcribed

7. In this lecture note, the quicksort algorithm is given. (a) Write the pseudocode for quicksort. (Or, a source code program in Java programming language. If this is the case, you are ONLY required to copy your source code in a Word file.) (b) Show that its worst-case running time on an array of size n is (n ). (Or, if you use source code, then create an input array A[0.. 100] as your input, and compute the number of your basic operations to establish t is (n*).) (c) Show that its expected running time satisfies the recurrence relation Then show that the solution to this recurrence is O(n log n) 8. Here we look at an alternative algorithm based on divide-and-conquer if a, b are even if a is odd, b is even if a, b are odd 2 gcd(a/2, b/2) gcd (a, b)gcd(a, b/2) gcd ((a b)/2, b) Show this rule is true (b) Give an efficient divide-and-conquer algorithm for finding greatest common divisor (c) How does the efficiency of your algorithm compare to Euclid's algorithm if a and b are n-bit integers? (In particular, since n might be large you cannot assume that basic arithmetic operations like addition take constant time.) 9. Use Algorithm prod2(x, y) for large integer multiplication to find the product 2506 and 69309. How many multiplication are needed to find the product of the two integers if prob2(x, y) is used

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

love of humour, often as a device to lighten the occasion;

Answered: 1 week ago

Question

orderliness, patience and seeing a task through;

Answered: 1 week ago

Question

well defined status and roles (class distinctions);

Answered: 1 week ago