Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Business Economics Expert

1. How many comparisons and interchanges (in terms of file size n) are performed by Simple insertion sort for the following files:

i) A sorted file

ii) A file that is sorted in reverse order (that is, from largest to smallest)

iii) A file in which x[0], x[2], x[4]... are the smallest elements in sorted order, and in which x[1], x[3], x[5]... are the largest elements in sorted order, e.g. [ 3 14 5 15 9 18 11 19 ].

2. How many comparisons and interchanges (in terms of file size n) are performed by Shell Sort using increments 2 and 1 for the following files:

i) A sorted file

ii) A file that is sorted in reverse order (that is, from largest to smallest)

iii) A file in which x[0], x[2], x[4]... are the smallest elements in sorted order, and in which x[1], x[3], x[5]... are the largest elements in sorted order, e.g. [ 3 14 5 15 9 18 11 19 ].

3. Determine which of the following sorts is most efficient. Consider if the data is small and simple or larger and more complex.

a) simple insertion sort

b) straight selection sort

c) bubble sort

4. Determine the number of comparisons (as a function of n and m) that are performed in merging two ordered files a and b of sizes n and m, respectively, by the merge method presented in the lecture, on each of the following sets of ordered files:

a. m=n and a[i] < b[i] < a[i+1], e.g. a=[ 6, 9, 12, 15, 29, 37] and b = [8, 10, 14, 25, 33, 45]

b. m=n and a[n] < b[1], e.g. a =[ 2, 5, 9] and b = [12, 14, 16]

a[i] refers the value in position i of file a, etc.

5. Determine the number of comparisons (as a function of n and m) that are performed in merging two ordered files a and b of sizes n and m, respectively, by the merge method presented in the lecture, on each of the following sets of ordered files:

a. m=n and a[n/2] < b[1] < b[m] < a[(n/2)+1],

e.g. a = [2, 5, 7, 55, 61, 72] and b =[9, 15, 17, 21, 29, 46]

b. m=1 and b[1] < a[1]

c. m=1 and a[n] < b[1]

a[i] refers the value in position i of file a, etc.

For questions 6 - 9, compare the efficiency of using sequential search on an ordered table of size n and an unordered table of the same size for the key key:

6. If no record with the key key is present

7. If one record with the key key is present and only one is sought.

8. If more than one record with the key key is present and it is desired to find only the first

9. If more than one record with the key key is present and it is desired to find them all.

Business Economics, Economics

  • Category:- Business Economics
  • Reference No.:- M92788012
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Business Economics

Now assume that a country a takes 100 hours to produce 20

Now assume that a country A takes 100 hours to produce 20 aircraft or 10 jet engines and country B takes 100 hour to produce 15 aircraft or 5 jet engines. Which country has an absolute advantage in which product? Does ei ...

Suppose that the demand curve for tickets to see a football

Suppose that the demand curve for tickets to see a football team play a game is given by Q = 80,000 - 40P and marginal cost is zero. The team's stadium can host 75,000 fans. i) How many tickets would the team sell if it ...

Discuss the benefits and challenges of developing

Discuss the benefits and challenges of developing center-based learning environments.

Trans-pacific partnership tppa what are the economic

Trans-Pacific Partnership (TPP) A. What are the economic implications? Provide a credible citation. B. What possible impact could this event have on global trade? Provide a credible citation. C. What is President Trump's ...

A psychologist examining art appreciation selected an

A psychologist examining art appreciation selected an abstract painting that had no obvious top or bottom. Hangers were placed on the painting so that it could be hung with any one of the four sides at the top. The paint ...

What are the main things to remember about elasticity

What are the main things to remember about elasticity, supply and demand, tax incidence, government controls on the market, and economic theories?

Describe 2 variables a government will look at to predict

Describe 2 variables a government will look at to predict where the economy will be in the next six months.

Sobel consumes positive quantities of both jam and juice

Sobel consumes positive quantities of both jam and juice. The price of jam is 5 cents per unit and the price of juice is 10 cents per unit. Her marginal utility of jam is 10 and her marginal utility of juice is 5. a. Wit ...

Suppose that the interest rate of government bonds in the

Suppose that the interest rate of government bonds in the Euro Area at 1 year maturity is 10%, or i €  =0.10 At the same time , the  interest rate of government bonds in the USA at 1 year maturity is 5%, or i $ =0.05 Sup ...

Why are many business and data series only presented in

Why are many business and data series only presented in seasonally adjusted data?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As