Oh, and in case you were wondering why I didn't update on the selection of siding and window colors, it's because Greg and I are deadlocked on the siding color. Greg wants medium cool grey and I want medium-dark warm grey. You'd think we were trying to decide on the name of our child or something. This could take a while...
Try using a randomized algorithm, like the Monte Carlo for example:
ReplyDeletefindingA_MC(array A, n)
begin
i=1
repeat
Randomly select one element out of n elements.
i = i + 1
until i=k
end
If an 'a' is found, the algorithm succeeds, else the algorithm fails. After k times execution, the probability of finding an 'a' is:
Pr[find_'a'] = 1 − (1 / 2)k
Randomized algorithms are particularly useful when faced with a malicious adversary, like a husband or wife.