how to find counterfeit coin out of 8 coins [closed] - algorithm

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
3 Suppose there are seven coins, all with the same weight, and a counterfeit coin that weights less than the others. How many weighings are necessary using a balance scale to determine which of the eight coins is the counterfeit one? Give an algorithm for finding this counterfeit coin.

Two weighings will suffice – compare coins 1,2,3 to 4,5,6 first, then you'll have two or three coins for the second comparision.

Related

n balls and n cups algorithm design [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 days ago.
Improve this question
You are given n balls and n cups. Each cup holds a particular weight, and once a ball is placed in it tells you whether the ball is too heavy or light or just right. You can’t compare the weight of the balls directly. A perfect pairing between balls and cups exist. Design an expected nlogn algorithm to find the pairing. Hint: modify quicksort.
I’ve thought about this problem for a long time with no leads.
Is there a efficient way to compare the weight of two balls, or am I thinking about this wrong? Can someone please give a hint?
If you compare all balls with a single randomly picked cup, you will find the matching ball, and the other balls will be partitioned into those higher and those lower. You can use the matching ball to also partition the cups in a similar way. Then you have essentially randomized quicksort.

Number of passwords [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
I've read this interesting problem:
how many different passwords made up of a upper case letters, b lower case letters, c digits and d characters from this set {'$','%','!','&','#'} exist?
This could be used to suggest strong passwords.
This is a basic combinatorics problem.
First of all, you have two base 26 numbers of lengths a and b, a base 10 number of length c and a base 5 number of length d. You have to multiply the number of these numbers to the number of ways you can arrange them, so you get:

Maximum number of clues in a Sudoku game that does not produce a unique solution [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
You may have heard that last year it was proven that the smallest number of starting clues for a Sudoku game, guaranteeing a unique solution, is 17.
An example is shown below.
I am interested in the opposite:
What is the largest number of starting clues for a Sudoku game that does not guarantee a unique solution?
I have a lower bound of 63. This is if you take a solved Sudoku and delete every instance of two numbers (i.e., delete all the 1s and 2s). Alternatively, you could delete the top two rows, again yielding two different solutions for 63 starting clues.
Can you do better than 63, or is 63 is the highest?

The English Tourist [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
"A tourist want to go from Liverpool to Sydney, visiting a number of other cities in the process.
for each pair of cities, he can travel by car, train or ferry, each option has a Cost and Time.
the goal is to go to syndey,traversing all cities in the process whilst keeping the time and cost to a minimum."
1-how do i verify that this problem is NP? given total time T and total cost C?
i.e: if i have 5 nodes, connected by 4 edges,
each edge has 3 options (car,ferry,train)
each option has Cost and time
how do i process the constraints? do i just try all permutations ?
2-i need guidance on actual solution, i do realize this is a subset of the Minimum spanning tree , but now i have 2 constraints, time and cost..how to tackle that ?
This kind of problem is solved with the Hungarian algorithm

On algrithms that minimizes maximal load of bins [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
There are n bins and m balls. Balls are with different weights, say ball i has weight w_i. Is there an algorithm that assigns balls into x<n bins so that maximal load of these bins is minimized.
This is equivalent to the multiprocessor scheduling problem, which is NP-complete. In other words: algorithm(s) exist, but they are very slow.
This is a disguised hash function question. i.e. You are looking for an optimal hash function. Check out this page - http://en.wikipedia.org/wiki/Hash_function
Generally you want a random key that you can XOR with w_i then take the result mod n to get the bin number.
Note: I took maximal load to mean number of balls per bin. Hashing of course does not work if you want to minimize the weight of each bin.

Resources