Programming > Solutions Guide > Solutions Manual > University of California, Santa Cruz - CMPS 201mid2solns./ CMPS 201 Analysis of A (All)

Solutions Manual > University of California, Santa Cruz - CMPS 201mid2solns./ CMPS 201 Analysis of Algorithms Fall 2018 Midterm Exam 2 Solutions

Document Content and Description Below

CMPS 201 Analysis of Algorithms Fall 2018 Midterm Exam 2 Solutions 1. (20 Points) Let ? be a randomly chosen non-negative integer having at most ? decimal digits, i.e. an integer in the range... 0 ≤ ? ≤ 10?- 1. Consider the following problem: determine ? by asking only 5- way questions, i.e. questions with at most 5 possible responses. For instance, one could ask which of 5 specific sets ? belongs to. Prove that any algorithm restricted to such questions, and which correctly solves this problem, runs in time Ω(?). Proof: Since there are exactly 10?possible verdicts, and every question has at most 5 answers, any algorithm solving this problem can be represented by a decision tree whose height ℎ satisfies ℎ ≥ ⌈log5(10?)⌉ = ⌈? ⋅ log5(10)⌉ = Ω(?). Therefore any algorithm that solves this problem runs in time Ω(?). ■ 2. (20 Points) Recall that the average case run time of RandSelect() satisfies the recurrence relation ?(?) = (? - 1) + (??-2 1) ∑ ?(?) ?-1 ?=1 Prove that ?(?) = Θ(?). Proof: First observe that ?(?) ≥ ? - 1 = Ω(?), so ?(?) = Ω(?). We prove now that ?(?) ≤ 2? for all ? ≥ 1 by induction. This shows that ?(?) = ?(?), and hence ?(?) = Θ(?) as required. I. Observe ?(1) = (1 - 1) + 1-1 12 ⋅ (empty sum) = 0 ≤ 2 = 2 ⋅ 1, establishing the base case. II. Let ? > 1, and assume for all ? in the range 1 ≤ ? < ? that ?(?) ≤ 2?. We must show ?(?) ≤ 2?. 3. (20 Points) Assume we are given 3 gold bars (labeled 1, 2, 3), one of which may be counterfeit: either goldplated lead (heavier than gold) or gold-plated tin (lighter than gold). Consider again the problem of finding which, if any, of the bars is counterfeit and what it is made of. The only tool at your disposal is a balance scale. Each use of the scale produces one of three possible outcomes: tilt left, balance, or tilt right. a. (10 Points) Give a decision tree argument establishing a lower bound on the (worst case) number of weighing's performed by any algorithm for this problem. (In your proof, clearly enumerate the set of possible verdicts.) Claim: Any algorithm solving this problem must use the balance at least 2 times. Proof: There are 7 possible verdicts to this problem: {1L, 1H, 2L, 2H, 3L, 3H, AllGold}, and each test has 3 possible outcomes. Thus any algorithm solving this problem can be represented by a decision tree whose height ℎ satisfies ℎ ≥ ⌈log3(7)⌉ = 2. Therefore 2 weighing's are necessary in worst case. ■ b. (10 Points) Design an algorithm that solves this problem by using the balance scale (at most) the number of times you found in (a). Express your algorithm as a decision tree. Solution: In the figure below, a branch left indicates that the scale tilts left, a vertical branch indicates that the scale balances, and branch right indicates the scale tilts right. Note that some outcomes are not possible at certain points in the algorithm, indicated by the absence of a branch right or left. 1 : 2 1 : 3 1 : 3 1 : 3 1H 2L 3L AllGold 3H 2H 1L ::::::::::::::::::::::::::::::::::::::::CONTENT CONTINUED IN THE ATTACHMENT::::::::::::::::::::::::::::::::::::::::::::::::::: [Show More]

Last updated: 1 year ago

Preview 1 out of 4 pages

Reviews( 0 )

Recommended For You

 Physics> Solutions Guide > Questions and Answers > University of Maryland - ECON 406HW1 Solutions. (All)

preview
Questions and Answers > University of Maryland - ECON 406HW1 Solutions.

1. Consider the model of Tversky and Kahneman developed in class. Let three dimensions of choice be mug (M), candy (C), and money (m), and the reference dependent utility be (a) What is the int...

By Kirsch , Uploaded: Feb 16, 2021

$12

 Managerial Economics> Solutions Guide > Managerial Economics in a Global Economy 8th Edition By Dominick Salvatore (Solutions Manual ) (All)

preview
Managerial Economics in a Global Economy 8th Edition By Dominick Salvatore (Solutions Manual )

Reflecting the highly globalized nature of tastes, production, labor markets, and financial markets in today's world, Managerial Economics in a Global Economy, Eighth Edition, presents the theory of t...

By eBookSmTb , Uploaded: Jun 01, 2022

$20

 Business Administration> Solutions Guide > Australasian Business Statistics 4th Edition By Black, Asafu ,Adjaye, Burke, Khan, King, Perera, Papadimos, Sherwood, Wasimi (Solution Manual All Chapters) (All)

preview
Australasian Business Statistics 4th Edition By Black, Asafu ,Adjaye, Burke, Khan, King, Perera, Papadimos, Sherwood, Wasimi (Solution Manual All Chapters)

Data-driven decisions are driving the global knowledge economy. To get the edge, graduates need the power of statistical analysis to create business insight. This fourth edition of Australasian Busine...

By eBookSmTb , Uploaded: Nov 23, 2021

$20

 Business Law> Solutions Guide > International Economics Theory and Policy 12th edition By Paul R. Krugman, Maurice Obstfeld, Marc Melitz (Solutions Manual ) (All)

preview
International Economics Theory and Policy 12th edition By Paul R. Krugman, Maurice Obstfeld, Marc Melitz (Solutions Manual )

1. Introduction PART 1: INTERNATIONAL TRADE THEORY 2. Word Trade: An Overview 3. Labor Productivity and Comparative Advantage: The Ricardian Model 4. Specific Factors and Income Distribution 5....

By eBookSmTb , Uploaded: Nov 05, 2022

$25

 Education> Solutions Guide > Essentials of Accounting for Governmental and Not-for-Profit Organizations, 14th Edition By Paul Copley (Solutions Manual ) (All)

preview
Essentials of Accounting for Governmental and Not-for-Profit Organizations, 14th Edition By Paul Copley (Solutions Manual )

The focus of Copley's Essentials of Accounting for Governmental and Not-for-Profit Organizations, 14th edition is on the preparation of external financial statements which is a challenge for governmen...

By eBookSmTb , Uploaded: Oct 07, 2022

$20

 Urban Policy and Planning> Solutions Guide > Dental list Yellow pages (All)

preview
Dental list Yellow pages

HumanaDental PPO dental directory Location: 15 miles from 07304 May 16, 2018 Dentist Locations: 4638 Get the most out of your dental plan. the covered person must send us a letter requesting a...

By Academia1434 , Uploaded: Mar 30, 2021

$1

 Statistics> Solutions Guide > MAT 240 Module Five Assignment Hypothesis Testing for Regional Real Estate Company (All)

preview
MAT 240 Module Five Assignment Hypothesis Testing for Regional Real Estate Company

Scenario You have been hired by the Regional Real Estate Company to help them analyze real estate data. One of the company’s Pacific region salespeople just returned to the office with a newly desi...

By ACADEMICTUTORIAL , Uploaded: May 26, 2022

$4

 Finance> Solutions Guide > Week 4 Mini Case Complete The Chapter 9 (All)

preview
Week 4 Mini Case Complete The Chapter 9

During the last few years, Jana Industries has been too constrained by the high cost of capital to make many capital investments. Recently, though, capital costs have been declining, and the company h...

By ACADEMICTUTORIAL , Uploaded: May 26, 2022

$3.5

 Accounting> Solutions Guide > ACCT370 Excel Project Part 3 (All)

preview
ACCT370 Excel Project Part 3

EXCEL PROJECT: PROJECTING FINANCIAL STATEMENTS ASSIGNMENT INSTRUCTIONS OVERVIEW Common Sized Balance Sheets (Tabs 12), Common Sized Income Statements (Tab 13), Horizontal Analysis Balanc...

By ACADEMICTUTORIAL , Uploaded: Feb 14, 2023

$6.5

 Business> Solutions Guide > Read the Chapter 19 Mini Case in Financial Management: Theory and Practice (All)

preview
Read the Chapter 19 Mini Case in Financial Management: Theory and Practice

Chapter 18 leasing and financing Chapter 19 Mini Case in Financial Management Lewis Securities Inc Read the Chapter 19 Mini Case in Financial Management: Theory and Practice. Using complete sen...

By ACADEMICTUTORIAL , Uploaded: May 01, 2023

$5.5

$12.00

Add to cart

Instant download

Can't find what you want? Try our AI powered Search

OR

GET ASSIGNMENT HELP
53
0

Document information


Connected school, study & course



About the document


Uploaded On

Feb 10, 2021

Number of pages

4

Written in

Seller


seller-icon
Kirsch

Member since 4 years

897 Documents Sold


Additional information

This document has been written for:

Uploaded

Feb 10, 2021

Downloads

 0

Views

 53

Document Keyword Tags

THE BEST STUDY GUIDES

Avoid resits and achieve higher grades with the best study guides, textbook notes, and class notes written by your fellow students

custom preview

Avoid examination resits

Your fellow students know the appropriate material to use to deliver high quality content. With this great service and assistance from fellow students, you can become well prepared and avoid having to resits exams.

custom preview

Get the best grades

Your fellow student knows the best materials to research on and use. This guarantee you the best grades in your examination. Your fellow students use high quality materials, textbooks and notes to ensure high quality

custom preview

Earn from your notes

Get paid by selling your notes and study materials to other students. Earn alot of cash and help other students in study by providing them with appropriate and high quality study materials.


$12.00

WHAT STUDENTS SAY ABOUT US


What is Browsegrades

In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Browsegrades · High quality services·