Question 4 (Module Outcome #4): Find the best-case, worst-case and average-case number of < comparisons are performed by the following piece of pseudo

Khadija Wells 2021-05-01 Answered

Question 4 (Module Outcome #4): Find the best-case, worst-case and average-case number of < comparisons are performed by the following piece of pseudocode. Precondition: \(n\in\{1,3,5,7,9\}\ \text{while}\ n < 6\ \text{do}\ n\leftarrow n+3\)

Expert Community at Your Service

  • Live experts 24/7
  • Questions are typically answered in as fast as 30 minutes
  • Personalized clear answers
Learn more

Plainmath recommends

  • Ask your own question for free.
  • Get a detailed answer even on the hardest topics.
  • Ask an expert for a step-by-step guidance to learn to do it yourself.
Ask Question

Expert Answer

Laith Petty
Answered 2021-05-02 Author has 5471 answers
Base-case: 1 comparison
Average-case: 1.8 comparisons
Worst-case: 3 comparisons
Have a similar question?
Ask An Expert
30
 

Expert Community at Your Service

  • Live experts 24/7
  • Questions are typically answered in as fast as 30 minutes
  • Personalized clear answers
Learn more

Relevant Questions

asked 2021-10-01
Question 4 (Module Outcome #4): Find the best-case, worst-case and average-case number of < comparisons are performed by the following piece of pseudocode. Precondition: n∈{1,3,5,7,9} while n < 6 do n←n+3
asked 2021-07-02
An investor plans to put $50,000 in one of four investments. The return on each investment depends on whether next year’s economy is strong or weak. The following table summarizes the possible payoffs, in dollars, for the four investments.
Certificate of deposit
Office complex
Land speculation
Technical school
amp; Strong amp;6,000 amp;15,000 amp;33,000 amp;5,500
amp; Weak amp;6,000 amp;5,000 amp;−17,000 amp;10,000
Let V, W, X, and Y denote the payoffs for the certificate of deposit, office complex, land speculation, and technical school, respectively. Then V, W, X, and Y are random variables. Assume that next year’s economy has a 40% chance of being strong and a 60% chance of being weak. a. Find the probability distribution of each random variable V, W, X, and Y. b. Determine the expected value of each random variable. c. Which investment has the best expected payoff? the worst? d. Which investment would you select? Explain.
asked 2021-11-18
Quick decision analysis Please pick the best outcome after calculation,
a) Council would accept \(\displaystyle{\left({P}_{{{2}}}={0.6}\right)}\) and the mayor would not veto \(\displaystyle{\left({P}_{{{3}}}={0.8}\right)}\), The probability of the compound event is
b) Council would accept \(\displaystyle{\left({P}_{{{2}}}={0.6}\right)}\) and the mayor would veto \(\displaystyle{\left({1}-{P}_{{{3}}}={0.2}\right)}\). The probability of the compound event is
c) Council would reject \(\displaystyle{\left({1}-{P}_{{{2}}}={0.4}\right)}\) and the council would retum the same budget \(\displaystyle{\left({P}_{{{4}}}={0.6}\right)}\). The probability of this compound event is
asked 2021-09-08
Is the complex number \(\displaystyle{z}={e}^{{2}}{e}^{{{1}+{i}\pi}}\) pure imaginary? Is it real pure?
Write its imaginary part, its real part, its module and argument. Write its complex conjugate.
Calculate and write the result in binomial form.
asked 2021-09-26

Driven by technological advances and financial pressures, the number of surgeries performed in physicians' offices nationwide has been increasing over the years. The function \(\displaystyle{f{{\left({t}\right)}}}=-{0.00447}{t}^{{{3}}}+{0.09864}{t}^{{{2}}}+{0.05192}{t}+{0.8}{\left({0}\leq{t}\leq{15}\right)}\) gives the number of surgeries (in millions) performed in physicians' offices in year t, with t=0 corresponding to the beginning of 1986.
a. Plot the graph of f in the viewing window [0,15] \(\times\) [0,10].
b. Prove that f is increasing on the interval [0, 15].

asked 2021-05-31

Driven by technological advances and financial pressures, the number of surgeries performed in physicians' offices nationwide has been increasing over the years. The function \(\displaystyle{f{{\left({t}\right)}}}=-{0.00447}{t}^{{{3}}}+{0.09864}{t}^{{{2}}}+{0.05192}{t}+{0.8}{\left({0}\leq{t}\leq{15}\right)}\) gives the number of surgeries (in millions) performed in physicians' offices in year t, with \(t=0\) corresponding to the beginning of 1986.
a. Plot the graph of f in the viewing window \([0,15]\times [0,10]\).
b. Prove that f is increasing on the interval [0, 15].

asked 2021-09-18
You have a single piece dice. What are the odds of:
a) Throwing it and getting 6?
b) Throwing it and getting an odd number?

Plainmath recommends

  • Ask your own question for free.
  • Get a detailed answer even on the hardest topics.
  • Ask an expert for a step-by-step guidance to learn to do it yourself.
Ask Question
...