[Unbalanced kod] Given a set of n weights {w₁,..., w} and a rod of length n - 1 inches, we can attach the weights to the rod at hooks placed at one inch distances apart as shown i below. -1" /10 2 3 4 12 2 We can attach a weight to any hook but no two weights can be attached to the same hook and we have to attach all the weights. For any given assignment of weights can compute the location of the center of mass of the rod and the weights according to the following equation (neglecting the weights of the rod and the hooks). Σi Wi-Pi C= Σ; wi where 0 ≤p; ≤ n - 1 is the position of weight i along the rod. pole in the fourro shoum abou

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
[Unbalanced Rod]
Given a set of n weights {w₁,..., wn} and a rod of length n - 1 inches, we can attach the weights to the rod at hooks placed at one inch distances apart as shown in the figure
below.
-1".
/10
2
3
12
2
4
We can attach a weight to any hook but no two weights can be attached to the same hook and we have to attach all the weights. For any given assignment of weights to hooks, we
can compute the location of the center of mass of the rod and the weights according to the following equation (neglecting the weights of the rod and the hooks).
where 0 ≤ Pi≤n-1 is the position of weight along the rod.
For example, in the figure shown above, the center of mass is computed as
C=
C =
i Wi Pi
Σi Wi
10 0+2 1+3·2+4·3+12.4 +2.5
10+2+3+4+12+2
78
33
The problem is to find an assignment of weights to hooks that makes the center of mass as far as possible to the left, i.e., minimize the value of c.
Answer the following questions.
1. Describe a greedy algorithm that finds the assignments that minimizes the value of c.
2. Prove the optimality of your algorithm.
3. Establish the running time of your algorithm.
= 2.36
Transcribed Image Text:[Unbalanced Rod] Given a set of n weights {w₁,..., wn} and a rod of length n - 1 inches, we can attach the weights to the rod at hooks placed at one inch distances apart as shown in the figure below. -1". /10 2 3 12 2 4 We can attach a weight to any hook but no two weights can be attached to the same hook and we have to attach all the weights. For any given assignment of weights to hooks, we can compute the location of the center of mass of the rod and the weights according to the following equation (neglecting the weights of the rod and the hooks). where 0 ≤ Pi≤n-1 is the position of weight along the rod. For example, in the figure shown above, the center of mass is computed as C= C = i Wi Pi Σi Wi 10 0+2 1+3·2+4·3+12.4 +2.5 10+2+3+4+12+2 78 33 The problem is to find an assignment of weights to hooks that makes the center of mass as far as possible to the left, i.e., minimize the value of c. Answer the following questions. 1. Describe a greedy algorithm that finds the assignments that minimizes the value of c. 2. Prove the optimality of your algorithm. 3. Establish the running time of your algorithm. = 2.36
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Recurrence Relation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education