WA3

.pdf

School

University at Buffalo *

*We aren’t endorsed by this school

Course

411

Subject

Computer Science

Date

Jan 9, 2024

Type

pdf

Pages

4

Uploaded by ProfComputerJellyfish103

ConanSam CSE 331 WHN Problem I The goal is to show that the output set has the highest profit margin Let A be the output set of the greedy algorithm and O be an optimal solution Let (I1 ... Ik) be the list of clients in A Let (J1 ... Jm) be the list of clients in O Since O is an optimal solution, the profit margin has to be the highest And since the greedy algorithm selects the client with the highest profit margin for each iteration Therefore the resulting list has to have the highest profit margin for the given potential client list Which shows that selecting the client with the highest profit margin is an optimal greedy choice
Problem 2 XY 2 x exe 2 tht yet The reason why the algorithm is correct is because x to the y can also mean that we multiply x y times, since the algorithm splits the bits in half, we have to combine the lower half and the upper half at the end to get the correct result. Similar to the recursive multiplication algorithm, the recursive power algorithm splits the input y to upper bits and lower bits, once it reaches the stopping condition where the bits cannot be split anymore, the upper bit(s) get multiplied by n times, then the result is multiplied by the lower bit(s).
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help