Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Consider a program P, which given the inputs b = #(big fruits in the basket X), s = #(sour fruits in X), and f

image text in transcribed

2. Consider a program P, which given the inputs b = #(big fruits in the basket X), s = #(sour fruits in X), and f = #all fruits in X). computes M = maximum number of fruits that could be both big and sour, and also computes m = mini- mum number of fruits that have to be both big and sour, (i) How do you know that P is no good if it outputs M = 8 for input (b, s, f) = (6, 7, 14)? (ii) Now suppose the program is modified and it outputs M = 6 for the above input but its other output m = 2. What can you say about the modified program and why? (iii) Give the code for computing M (= at most...) and m (= at least ...) from inputs b, s, and f. (iv) If we just want to compute M, what should be the inputs? What if we just want to compute m? 2. Consider a program P, which given the inputs b = #(big fruits in the basket X), s = #(sour fruits in X), and f = #all fruits in X). computes M = maximum number of fruits that could be both big and sour, and also computes m = mini- mum number of fruits that have to be both big and sour, (i) How do you know that P is no good if it outputs M = 8 for input (b, s, f) = (6, 7, 14)? (ii) Now suppose the program is modified and it outputs M = 6 for the above input but its other output m = 2. What can you say about the modified program and why? (iii) Give the code for computing M (= at most...) and m (= at least ...) from inputs b, s, and f. (iv) If we just want to compute M, what should be the inputs? What if we just want to compute m

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions