Question: [Pseudocode] [Algorithm] Improving Efficiency I am supposed to further improve the efficiency of this given algorithm. (Provided Below) Q) So you improved your Findfake algorithm

[Pseudocode] [Algorithm] Improving Efficiency

I am supposed to further improve the efficiency of this given algorithm. (Provided Below)

Q) So you improved your Findfake algorithm substantially by dividing the piles of coins into 3 rather than 2... Let's keep on going then...

Can you come up with a value of m>3 and a Findfakem algorithm which splits the pile of coins at every step into m equal sized piles and which has a better worst case efficiency than Findfake3? Explain your answer methodically and support it mathematically. Please provide explanation regarding why it is better?

Findfake3(coinpile, n) if n=1 return the first coin in coinpile if n=2 and weight of coin1 > weight of coin2 then return coin2 else return coin1 thirdn = n div 3 pile1 = 1/3rd of the first coins in coinpile pile2 = 1/3rd of the next coins in coinpile pile3 = 1/3rd of the last coins in coinpile compareweight = Weigh(pile1,pile2,pile3); if compareweight = 1 return Findfake3(pile1,thirdn) if compareweight = 2 return Findfake3(pile2,thirdn) if compareweight = 3 return Findfake3(pile3,thirdn) return Findfake(last 2 coins of coinpile,2) //Weigh(coinpile1, coinpile2, coinpile3) returns: //0 if all 3 coinpiles have equal weight //1 if coinpile2 and coinpile3 weigh the same //2 if coinpile1 and coinpile3 weigh the same //3 if coinpile1 and coinpile2 weigh the same

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!