You are on page 1of 1

rk

eo

te

o ngs. You manufacture them in sets of 10 per


ste en hn ea ‘One day, you notice that the total weight
Each bal 5
ne box of ball bearings shows up as 9.999 grams. You suspect one of the 10
ball bearings in this box is slightly lighter than the rest
hat can help you find this faulty ball
Thankfully, you have @ weighing balance tl i
bearing. \Snfortunately you do not have any other weights to compare them
to. and thus myst only yse the ball bearings themselves on both sides of the
balance.
Since this balance is highly sensitive and fragile, you want to use itas few times
3s possible. Determine a method to find the faulty ball bearing by using the
weighing balance only thrice. Write a psuedocode for the same.
What changes must be made to the pseudocode if the problem is generalised
«. instead of 10 ball bearings, there are n ball bearingsina box with one of them

faulty, and we still want to minimise the number of times we use the weighing
balance

You havea steel rod of length n. In the market, steel rods of different lengths can
be sold for different prices. Itis not necessary that the longer the rod, the more
it sells for because some industry specific lengths can have more demand in

the market. ( For example, if all factories utilise a 10 m


, etre rod,
rod will not sell as well as a 10 metre rod. ) (os. ne a

‘eels machine that can cut your rod in two pieces of any length that you
eee Hedda et can determine what lengths your rod should be
oF your profit upon selling the pieces, (orifit should be cut at

As input, you will be provide


paki provided the length of your rod n, and prices for rods of all

Ifinstead,
Honea Phen into as many pieces as we want, what modifica~
cut our rod into? Pseudocode to determine the pieces we should

You might also like