Reference no: EM131182162
Problem 1:
Write the function insertion_sort(a) that takes an array of numbers and returns an array of the same values in nondecreasing order, without modifying a.
Your function should use the insert function written in the previous problem.
>> b = Array.new(12) {Random.rand(100)}
=> [30, 81, 43, 95, 24, 38, 64, 56, 74, 70, 33, 60]
>> insertion_sort(b)
=> [24, 30, 33, 38, 43, 56, 60, 64, 70, 74, 81, 95] >> b
=> [30, 81, 43, 95, 24, 38, 64, 56, 74, 70, 33, 60]
>> insertion_sort(b) == b.sort
=> true
Problem 2:
The factorial of an integer n is defined fact(n)=n!=n?(n-1)?(n-2)???1.
Define five different versions of the function fact, named fact1, ... fact5. Try to achieve significant variety among your functions.
>> fact1(5)
=> 120
>> fact2(40)
=> 815915283247897734345611269596115894272000000000
Identify and describe a business crisis
: Identify and describe a business crisis situation and the main leaders involved. It could be one that you have experienced or have read about. Be sure to include a discussion of ethical implications
|
Dosages resembles a normal distribution reasonably closely
: In a sample of 100 syringes, the hospital's quality control officer finds the average dosage to be 0.5mL. The standard deviation of the dosage is 0.02 mL and the distribution of the dosages resembles a normal distribution reasonably closely.
|
How will you sell the product in that country
: What is the product that you plan to sell? - What foreign country do you plan to target? - How will you sell the product in that country?
|
Formulate an alternative hypothesis
: Formulate an alternative hypothesis for each of the following null hypotheses. (a) H0: Support for a presidential candidate is unchanged after the start of the use of TV commercials.
|
Write the function insertion_sort
: Write the function insertion_sort(a) that takes an array of numbers and returns an array of the same values in nondecreasing order, without modifying a.
|
Expected number of people that leave the drive-thru
: What is the expected number of people that leave the drive-thru with their orders filled in any given 4 minute interval?
|
How can you use goal-setting to increase motivation
: Develop strategies to advance your career using your strengths. How can you use goal-setting to increase motivation and improve job performance? How might your engagement as an employee and job satisfaction influence job performance
|
How many ties of each type may it possibly have
: Ties Unlimited stocks $1 ties, $2 ties, and $4 ties. If it has a total inventory of 7,000 ties valued at $12,000. How many ties of each type may it possibly have? If the number of $2 ties is 2,000 how many of each type are there?
|
Required to manufacture units
: It took a contractor 1285 hours to manufacture their first unit of an item. If the contractor expects to achieve a 92% unit learning curve, how many hours would be required to manufacture units 52-100?
|