Algorithm to detect single bad coin using pan balance

Eight coins are identical in appearance, but one coin is either heavier or lighter than the others, which all weigh the same.

Describe an algorithm that identifies the bad coin in at most three weighings and also determines whether it is heavier or lighter than the others, using only a pan balance.

Solution Preview

The algorithm description below has been interspersed with pseudo code, apart from the logic explaining hows and whys behind working of this algorithm.

Notation "W(X)" in the description indicates the weight of coins in set X.
Initially, the coins are labelled as C1, C2, C3, C4, C5, C6, C7 and C8.

1. Divide the given 8 coins into 3 sets of size (3,3,2) coins respectively i.e.

S1 = {C1, C2, C3}
S2 = {C4, C5, C6}
S3 = {C7, C8}

if (W(S1) == W(S2)) {
The bad coin is either C7 or C8. Go to step 2 to find it.
} else {
The bad coin is one of {C1,...,C6}. Go to step 3 to find it.
}

2. Since the coins in sets S1 and S2 i.e. {C1,..,C6} are of right weight, we pick up any coin from either of these two sets and refer to it as R.

if (W({C7}) != W({R})) {
C7 is the bad coin. It's weight relationship with R
determines whether it is heavier or lighter.

} else {
C8 is the bad coin. We ...

Solution Summary

Solution describes an algorithm to detect the single bad coin, interspersed with pseudo code, analysis and detailed explanations on hows and whys behind correct working of this algorithm.

Please help with these 2 problems in algorithm efficiency. View attached file.
1. Rank the terms of the following function according to their order of growth. Give explanation.
2. Consider the following algorithm where n is a positive integer.
What is the efficiency class of this algorithm? Show your reasoning.

1. Pick any number and add 10 to the number. Divide the sum by 5. Multiply the quotient by 5. Subtract 10 from the product . Then subtract your original number.
a. What is the result?
b. Arbitrarily select some different numbers and repeat the process.
c. Can a conjecture be made regarding the result when this process is fo

We have 21 coins and are told that one is heavier than any of the other coins. How many weighings on a balnce will it take to find the heaviest coin? (Hint: If the heaviest coin is in a group of three coins, we can find it in one weighing. Then work backward to two weighings, and so on).

A coin is placed on a record that is rotating at 33.3 revolutions per minute. If the coefficient of static friction between the coin and the record is 0.1, how far from the center of the record can the coin be placed without having it slip off?

Greedy Algorithms
procedure change (c1, c2, ...., cr: values of denominations of coins, where c1 > c2 > ... > cr; n: a positive integer)
for i : = 1 to r
while n ≥ ci
begin
add a coin with value ci to the change
n :=n - ci
end
2. Use the greedy algorithm to make change using quarters, dimes, ni

Here is a proposed algorithm to solve the single source shortest paths problem in a weighted directed graph G with possibly negative edges weights, but no negative weight cycles:
Form the graph G' from G by adding the same positive number, p, to all of the edge weights in the graph. This positive number should be chosen so th

Need at least 600 words in length defending your response to the following questions:
Strategically, what must Pan-Europa do to keep from becoming the victim of a hostile takeover? What should Pan-Europa do now that they have won the price war? Who should lead the way for Pan-Europa?
Using net present value (NPV), cond

Single Source Longest-Path Problem
? A longest-path problem can be transformed into a shortest path problem by changing the sign of all weights
? Alternatively, the Bellman-Ford algorithm can be transformed into a
"longest path" algorithm by changing the initialization and relaxation
procedures
Initialization step of

I have an algorithm called MinDistance that determines the distance between the two closest elements in an array. I need to make it more efficient.
Here is the algorithm, written in pseudocode:
MinDistance(A[0...n-1]
dmin <-- infinity
for i <--- 0 to n - 1 do
for j <--- 0 to n - 1 do
if i does not equal j a