Comp 363 Study Problems for Test 2

Similar documents
Soving Recurrence Relations

In nite Sequences. Dr. Philippe B. Laval Kennesaw State University. October 9, 2008

Infinite Sequences and Series

Section 11.3: The Integral Test

2-3 The Remainder and Factor Theorems

Trigonometric Form of a Complex Number. The Complex Plane. axis. ( 2, 1) or 2 i FIGURE The absolute value of the complex number z a bi is

5.3. Generalized Permutations and Combinations

CS103X: Discrete Structures Homework 4 Solutions

Chapter 5: Inner Product Spaces

SAMPLE QUESTIONS FOR FINAL EXAM. (1) (2) (3) (4) Find the following using the definition of the Riemann integral: (2x + 1)dx

Lecture 4: Cauchy sequences, Bolzano-Weierstrass, and the Squeeze theorem

BINOMIAL EXPANSIONS In this section. Some Examples. Obtaining the Coefficients

FIBONACCI NUMBERS: AN APPLICATION OF LINEAR ALGEBRA. 1. Powers of a matrix

.04. This means $1000 is multiplied by 1.02 five times, once for each of the remaining sixmonth

SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES

5 Boolean Decision Trees (February 11)


CS103A Handout 23 Winter 2002 February 22, 2002 Solving Recurrence Relations

Elementary Theory of Russian Roulette

Our aim is to show that under reasonable assumptions a given 2π-periodic function f can be represented as convergent series

S. Tanny MAT 344 Spring be the minimum number of moves required.

Chapter 6: Variance, the law of large numbers and the Monte-Carlo method

Sequences and Series

CME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 8

Example 2 Find the square root of 0. The only square root of 0 is 0 (since 0 is not positive or negative, so those choices don t exist here).

1. C. The formula for the confidence interval for a population mean is: x t, which was

Incremental calculation of weighted mean and variance

1. MATHEMATICAL INDUCTION

4.3. The Integral and Comparison Tests

Properties of MLE: consistency, asymptotic normality. Fisher information.

Convexity, Inequalities, and Norms

Solutions to Exercises Chapter 4: Recurrence relations and generating functions

Chair for Network Architectures and Services Institute of Informatics TU München Prof. Carle. Network Security. Chapter 2 Basics

Basic Elements of Arithmetic Sequences and Series

The Stable Marriage Problem

Department of Computer Science, University of Otago

Your organization has a Class B IP address of Before you implement subnetting, the Network ID and Host ID are divided as follows:

Definition. A variable X that takes on values X 1, X 2, X 3,...X k with respective frequencies f 1, f 2, f 3,...f k has mean

Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

1 Computing the Standard Deviation of Sample Means

Asymptotic Growth of Functions

5.4 Amortization. Question 1: How do you find the present value of an annuity? Question 2: How is a loan amortized?

Determining the sample size

THE ARITHMETIC OF INTEGERS. - multiplication, exponentiation, division, addition, and subtraction

Approximating Area under a curve with rectangles. To find the area under a curve we approximate the area using rectangles and then use limits to find

Confidence Intervals for One Mean

*The most important feature of MRP as compared with ordinary inventory control analysis is its time phasing feature.

How To Solve The Homewor Problem Beautifully

Chapter 7 Methods of Finding Estimators

Lecture 13. Lecturer: Jonathan Kelner Scribe: Jonathan Pines (2009)

AP Calculus BC 2003 Scoring Guidelines Form B

Math 113 HW #11 Solutions

University of California, Los Angeles Department of Statistics. Distributions related to the normal distribution

I. Chi-squared Distributions

CHAPTER 3 THE TIME VALUE OF MONEY

A Faster Clause-Shortening Algorithm for SAT with No Restriction on Clause Length

INFINITE SERIES KEITH CONRAD

SEQUENCES AND SERIES

Cooley-Tukey. Tukey FFT Algorithms. FFT Algorithms. Cooley

where: T = number of years of cash flow in investment's life n = the year in which the cash flow X n i = IRR = the internal rate of return

MATH 083 Final Exam Review

CHAPTER 3 DIGITAL CODING OF SIGNALS

UC Berkeley Department of Electrical Engineering and Computer Science. EE 126: Probablity and Random Processes. Solutions 9 Spring 2006

The analysis of the Cournot oligopoly model considering the subjective motive in the strategy selection

Integer Factorization Algorithms

Hypergeometric Distributions

FOUNDATIONS OF MATHEMATICS AND PRE-CALCULUS GRADE 10

A Combined Continuous/Binary Genetic Algorithm for Microstrip Antenna Design

1 Correlation and Regression Analysis

Descriptive Statistics

THE REGRESSION MODEL IN MATRIX FORM. For simple linear regression, meaning one predictor, the model is. for i = 1, 2, 3,, n

Sequences and Series Using the TI-89 Calculator

NATIONAL SENIOR CERTIFICATE GRADE 12

Measures of Spread and Boxplots Discrete Math, Section 9.4

CHAPTER 11 Financial mathematics

Sampling Distribution And Central Limit Theorem

Solving Logarithms and Exponential Equations

Maximum Likelihood Estimators.

Output Analysis (2, Chapters 10 &11 Law)

Fast Fourier Transform

GCE Further Mathematics (6360) Further Pure Unit 2 (MFP2) Textbook. Version: 1.4

Concept: Types of algorithms

Math C067 Sampling Distributions

Irreducible polynomials with consecutive zero coefficients

A Recursive Formula for Moments of a Binomial Distribution

EGYPTIAN FRACTION EXPANSIONS FOR RATIONAL NUMBERS BETWEEN 0 AND 1 OBTAINED WITH ENGEL SERIES

Analysis Notes (only a draft, and the first one!)

a 4 = = Which of the following sequences converge to zero? n 2 (a) n 2 (b) 2 n x 2 x = lim x n = lim x

CHAPTER 7: Central Limit Theorem: CLT for Averages (Means)

Project Deliverables. CS 361, Lecture 28. Outline. Project Deliverables. Administrative. Project Comments

CS85: You Can t Do That (Lower Bounds in Computer Science) Lecture Notes, Spring Amit Chakrabarti Dartmouth College

DAME - Microsoft Excel add-in for solving multicriteria decision problems with scenarios Radomir Perzina 1, Jaroslav Ramik 2

A Mathematical Perspective on Gambling

Week 3 Conditional probabilities, Bayes formula, WEEK 3 page 1 Expected value of a random variable

Repeating Decimals are decimal numbers that have number(s) after the decimal point that repeat in a pattern.

Section 8.3 : De Moivre s Theorem and Applications

Overview of some probability distributions.

7.1 Finding Rational Solutions of Polynomial Equations

Building Blocks Problem Related to Harmonic Series

Solutions to Selected Problems In: Pattern Classification by Duda, Hart, Stork

Transcription:

Comp 363 Study Problems for Test 2 October 24, 2003 Dr. Joh G. Del Greco Name Istructios. There are o special istructios for these practice problems. 1. For Test #2, you should kow... Chapter 1 ad Sectios 2.1 through 2.4 of the text (Sectios 2.5 through 2.7 are optioal sectios) what the three characteristics of divide-ad-coquer algorithms are as discussed i class how QuickSort qualiþes as a divide-ad-coquer algorithm, that is: (a) umber of subproblems the problem is divided ito (b) size of the subproblems (c) whether the recombiatio step is empty or ot how MergeSort works ad how it qualiþes as a divide-ad-coquer algorithm (see questios (a), (b) ad (c) for the correspodig questio o QuickSort) how to demostrate MergeSort o a give array (see p. 125 of the text) howtomergetwosortedlists the recurrece relatio for the worst-cost ruig time of MergeSort how to solve the recurrece relatio for the worst-cost ruig time of MergeSort whe the array is a power of two i legth ad oly comparisos are couted what the efficiecy class of MergeSort is how to geerate a decisio tree for a sortig algorithm like IsertioSort at least how may leaf odes a decisio tree for a sortig algorithm must have for iputs of size that a upper boud o the umber of leaves i a biary tree of depth d is 2 d ad be able to prove it by iductio o d that d dlog 2 #e where d is the depth of a biary tree ad # is the umber of leaves for ay algorithm A that sorts lists of size, iffollowsthatc A () dlog 2!e (ad how to prove this from the previous two bullet items) that if f(x) is a mootoically icreasig fuctio o a iterval [m 1,+1], the R m 1 f(x)dx P i=m f(i) R +1 m f(x)dx how to use the result i the previous bullet item to show that log 2! Θ( log 2 ) P how to use the result i the previous bullet item to show that i k Θ( k+1 ) i=1

how BiarySearch works ad how it qualiþes as a divide-ad-coquer algorithm (see questios (a), (b) ad (c) for the correspodig questio o QuickSort) both versios of BiarySearch, the orecursive ad recursive versios how to demostrate BiarySearch o a give array (that is, keepig track of upper, lower ad middle) what the recurrece relatio for BiarySearch is how to solve the recurrece relatio for BiarySearch whe the array is a power of two i size what the exact solutio to the recurrece relatio for BiarySearch is, eve whe the array is ot a power of two i size how to geerate a decisio tree for BiarySearch for a array of ay size how to compute the average-case ruig time of BiarySearch give the decisio tree (see text, p. 136, problem #1(c)(d)) how to state all three cases of the Master Theorem how to apply the Master Theorem to determie the efficiecy class of the solutio to a recurrece relatio how to perform Strasse s algorithm what the recurrece relatio for Strasse s algorithm is ad how to solve it usig the Master Theorem how to multiply large umbers what the recurrece relatio is for the algorithm for multiplyig large umbers ad how to solve it how c A () is deþed as a sum what iput equivalecig is how to perform a average-case aalysis of LiearSearch uder differet assumptio: X is i the list, X is equally likely to be i the list as ot i the list, etc. what the recurrece relatio is for the average-case ruig time of LiearSearch whe X is i the list what the recurrece relatio is for the average-case ruig time of QuickSort what the average-case ruig time of QuickSort is (that is, the solutio to the recurrece relatio for QuickSort) what the th harmoic umber is what its growth rate is 2. Perform MergeSort o the array below. 16 33 56 11 50 31 7 49 60 2 3. Carefully costruct a decisio tree for SelectioSort o lists of size =3. Assume the lists cotai distict etries. 2

4. Aswer the followig questios. (a) Let f(x) be a mootoe decreasig fuctio o the iterval [m 1,+1]. Prove that R +1 f(x)dx P f(i) R f(x)dx. m m 1 i=m (b) Usig the result i part (a), prove that the th harmoic umber H = P satisþes l( +1) H l +1. (Hit: Cosider f(x) =1/x o a suitable iterval.) (c) Prove that H Θ(l ) usig the deþitio of Θ. (That is, do ot use limits.) 5. Suppose a certai array has the followig values for its compoets. -7-4 -1 0 3 4 5 6 9 11 13 14 15 19 23 Perform a trace of BiarySearch for the search key X =16. That is, write dow the sequece of values for the variables upper, lower ad middle. 6. Complete the followig questios about BiarySearch. (a) Costruct a decisio tree for BiarySearch for lists of size =15. (b) Fid the average-case ruig time for BiarySearch i a successful search of a array of size =15. (See text, p. 136, problem #1(c).) (c) Fid the average-case ruig time for BiarySearch i a usuccessful search of a array of size =15. (Your may assume that searches for keys i each of the 16 itervals formed by the arrays elemets are equally likely.) 7. Aswer the followig questios about the average-case ruig time of LiearSearch. (a) Write dow a recurrece relatio for the average-case ruig time of LiearSearch whe the search key X is equally likely ot to be i the list as to be ay of the elemets of the list. (b) Solve the recurrece relatio i part (a) by urollig. 8. Solve the followig recurreces usig the Master Theorem. (a) T () =5T (/2) + 2 log 2 (b) T () =27T (/3) + 3 log (c) T () =3T (/4) + log 9. What is the largest value of a such that if we could multiply two 3 3 matrices usig oly a multiplicatios, the we could multiply two matrices i time faster tha log 7. (Recall that log 7 is the ruig time of Strasse s algorithm.) What would be the ruig time of the resultig algorithm? 10. Use divide-ad-coquer multiplicatio to multiply the umbers 2,345 ad 6,789. 3 i=1 1 i

11. Show how two biomials ax + b ad cx + d ca be multiplied usig oly three multiplicatios. 12. Based o your experiece i the previous problem, show how to multiply two th degree polyomials i log 3 time. 13. The purpose of this exteded problem is to ivestigate the average-case ruig time of BiarySearch. You should cosider it a jourey durig which you ca tur back at ay time. (The istructor strogly suggests that you at least do parts (a) through (d).) Fiishig the jourey however is very satisfyig! Oe way to aalyze the average-case ruig time of BiarySearch is to costruct a recurrece relatio for it. LetussupposethatthesearchkeyX is i the list ad that X is equally likely to be i ay of the positios. Cosider the followig recurrece relatio where A is BiarySearch. (For coveiece, let f() =c A ().) 0,if =0 f() = 1,if =1 d 2 e 1 f b 2 1 + 2 c f 2 +1,if 2 (a) Explai the Þrst two lies i the recurrece relatio for f(). (b) Now cosider the third lie of the recurrece relatio. 1. What does the quatity d 2 e 1 represet? Why is it beig multiplied by f 2 1? 2. Explai the secod term of the sum. 3. Fially, explai why the last term of the sum is 1. (c) Solvig the recurrece is difficult! Nevertheless, some progress ca be made by simplifyig it somewhat. Multiply the recurrece through by, adthelet g() =f(). Show that the recurrece ca be writte as 0,if =0 g() = 1,if =1 g 2 1 + g 2 +,if 2 (d) Show that g() g( 1) = g 2 g 2 1 +1(Use the easily prove idetity 1 2 = 2 1 i your derivatio.) (e) Let h() =g() g( 1). Show that ½ 1,if =1 h() = h 2 +1,if 2 (f) The recurrece i part (e) has already bee solved i class! Why did we solve this recurrece, ad what was the solutio? (g) From part (f), show that g() =g( 1) + dlog 2 ( +1)e. (h) Uroll the equatio i part (g) to show that g() = +1 P dlog 2 e. 4

(i) Sice g() =f() (recall part (c)), show that f() = 1 (j) Evaluatig the sum +1 P It ca be show that +1 P dlog 2 e. dlog 2 e i the formula for f() i part (i) is rather tricky! X+1 dlog 2 e =( +1)dlog 2 ( +1)e 2 dlog 2 (+1)e +1 Give this result, show that the Þal aswer for f() is µ 2 dlog (+1)e 2 dlog f() =dlog 2 ( +1)e 2 ( +1)e 1 (k) The Þrst term i the formula for f(), amelydlog 2 ( +1)e, istheworst-case ruig time of BiarySearch. (This was prove i class. See your otes.) So otice what the formula is sayig. The average-case ruig time of BiarySearch is equal to its worst-case ruig time mius the quatity i paretheses. The crucial questio is how large ca this quatity i the parethesis ca get? Plug i some umerical values for ad try to get a feel for what is happeig. Make a cojecture as to how large the quatity ca get. What does your cojecture say about the average-ruig time of BiarySearch? Is it disappoitig to you? 5