/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Q8E Justify the correctness of the r... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

Justify the correctness of the recursive division algorithm given in page 25, and show that it takes time O(n2)onn- bit inputs.

Short Answer

Expert verified

Recursive division algorithm can be defined as dividing a number from another number which needs to satisfy the condition as,Dividend=Divisor*quotient+Remainder.

Step by step solution

01

Introduction

A recursive function is a piece of code that executes by referencing itself. Simple or complex recursive functions are both possible. They enable more effective code authoring, such as the listing or compilation of collections of integers, strings, or other variables using a single repeated procedure.

02

Recursive Function

Let the function is given as, recursive_division(a,b).

Enter two n-bit integersa and b , where b≥1.

Final output is quotient and remainder of a recursive_division by b.

If a=0: return (q,r)=(0,0)

role="math" localid="1658389148708" (q,r)=recursive_division(ba÷2c,b)q=2×q, r=2×r

If x is odd :r=r+1

If r≥y

r=r−y,q=q+1return(q,r)

03

Final answer

So, the recursive function will get call up to 2 times in the given function n. So, time complexity of the given function is O(n2)forn bits input.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91Ó°ÊÓ!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Unlike a decreasing geometric series, the sum of the1,12,13,14,15,..... diverges; that is,∑i=1n1i=∞

It turns out that, for large n , the sum of the first n terms of this series can be well approximated as

∑i=1n1i≈Inn+y

where is natural logarithm (log base e=2.718...) and y is a particular constant 0.57721...... Show that

∑i=1n1i=θ(logn)

(Hint: To show an upper bound, decrease each denominator to the next power of two. For a lower bound, increase each denominator to the next power of 2 .)

Find the inverse of:.20mod79,3mod62,21mod91,5mod23

Is 41536-94824 divisible by35 ?

Quadratic residues. Fix a positive integer N. We say that a is a quadratic residue modulo N ifthere exists a such that a≡x2modN.
(a) Let N be an odd prime and be a non-zero quadratic residue modulo N. Show that there are exactly two values in{0,1,....,N-1} satisfying x2≡amodN.
(b) Show that if N is an odd prime, there are exactly(N+1)2 quadratic residues in {0,1,...,N-1}.
(c) Give an example of positive integers a and N such thatx2≡amodNhas more than two solutions in {0,1,...,N-1}.

1.37. The Chinese remainder theorem.
(a) Make a table with three columns. The first column is all numbers from 0 to 14. The second is the residues of these numbers modulo 3; the third column is the residues modulo 5. What do we observe?
(b) Prove that if p and q are distinct primes, then for every pair (j, k) with 0≤j<qand 0≤k<q, there is a unique integer 0≤i<pqsuch thati≡jmodp andi≡kmodq. (Hint:
Prove that no two different i's in this range can have the same (j, k), and then count.)
(c) In this one-to-one correspondence between integers and pairs, it is easy to go from i to (j, k). Prove that the following formula takes we the other way:
i={j.qq-1modp+kpp-1modq}modpq
(d) Can we generalize parts (b) and (c) to more than two primes?

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.