Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose that the input is a list L of numbers with the \"promise\" that at least

ID: 670724 • Letter: S

Question

Suppose that the input is a list L of numbers with the "promise" that at least 90% of the numbers in the list are positive or at least 90% of the numbers in the list are negative. In the former case, we say that L is positive and in the latter case we say that L is negative. My goal in this problem is to design and analyze a fast, randomized algorithm that determines if L is positive or negative. Here is my attempt at doing this. What is the running time of this algorithm? This algorithm can, on ocassion, produce incorrect output. Explain how this can happen. Suppose that the input L is positive. Calculate the probability that the output of the above algorithm is "negative." To help you with this calculation, note that for the output to be "negative" it must be the case that: L[i1] and L[i2] are negative, but L[i3] is positive or L[i1] and L[i2] are negative, but L[i2] is positive or L[i2] and L[i2] are negative, but L[i1] is positive or L[i1], L[i2], and L[i3] are all negative. Calculate the probability of each of the events (A), (B), (C), and (D), given that L is positive. The sum of these probabilities is the probability that the algorithm will output "negative" even though L is positive.

Explanation / Answer

1.the running time T(n)=kn where k is constant.the worst case would be n! time complexity is O(n)

2.if the input of the given numbers contain Zero (more than one) and one other i.e either a positive or negitive then we can get the wrong answer

3.in all the three cases the ouput is negitive even though the L is positive.last case it is negitive since all are negitive .total probability is 25%

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote