How many comparisons and interchanges

Assignment Help Business Management
Reference no: EM131951741

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.

Reference no: EM131951741

Questions Cloud

How effective was the opening that dr pausch used : Describe how this video made you feel. Sad...but perhaps inspired? How did his delivery help to create how you felt about his lecture?
Write a paper on immigration : Write a paper on immigration before 1877 focusing on immigrant groups like the Irish and the Germans. The Term Paper should be at least six pages.
Characterized by an emerging design : In terms of data collection, what is meaning that many of the qualitative studies are characterized by an emerging design?
Calculate management efficiency : Strong franchise value- this is the best source of growth. Does your target company have one it's probably not maximising?
How many comparisons and interchanges : 1. How many comparisons and interchanges (in terms of file size n) are performed by Simple insertion sort for the following files:
How does each point support your overall persuasive position : How does each point support your overall persuasive position? What source did you find to support your point(s)?
Write a research paper about the nullification crisis : Write a research paper about The Nullification Crisis. All the details are given on the document attached below and I want it on the same format and ways.
Discuss about the post-baccalaureate degree : How do you plan to use your post-baccalaureate degree to impact the world through academics, leadership and service? The response must be typed, single spaced.
Describe the importance of the research topic : Research/find a minimum at least two (2), preferably three (3) different peer-reviewed articles on your topic.

Reviews

Write a Review

Business Management Questions & Answers

  Structural approaches the business uses

1. Select your business and give a short description. 2. Identify which one of the 5 structural approaches the business uses. (review Exhibit 7.9 in Chapter 7)

  Types of project management approaches

Provide description of which types of project management approaches are used by your HSO or an HSO with which you are familiar. Then, explain the strengths and weaknesses of using these types of project management approaches in contributing value ..

  Self-performance appraisal - human resourcesplease assist

self-performance appraisal - human resourcesplease assist in providing a template for each topic in bold- business

  Income effects for leisure of an increase in the wage rate

Jasmine can work as much as 64 hours per week. She receives $200 per week in non-wage income. Her utility function for leisure and consumption is U(R,C)=320R^(1/2)+2C, where R is hours of leisure and C is consumption. The price of consumption is u..

  Feedback on your competency progress

Discuss how you will incorporate all that you have learned from this course, and this Plan, into a norm for continuous improvement.

  Attention to workplace attitudes

Why is it important for management to pay attention to workplace attitudes?

  Group at an outdoor apparel retailer

The internet marketing group at an outdoor apparel retailer is "at war" with the retail stores group.

  Uncertainty and risks

In the video, Michael T. Pich, one of the textbook authors, recommends two approaches for uncertainty and subsequently risks. As companies strive to remain in business, there are many economic, social, and technological unknowns. As a project lead..

  Position to advise keurig grenn mountain

If you were in a position to advise Keurig Grenn Mountain, what strategy would you recommend to sustain competitive advantage and achieve future growth? Be specific and list the steps the company should take for successful implementation of your c..

  Understand break-even analysis

Selling price to Yumminess at $10 per tin. The cost is $8 per tin, which includes $6 of direct material and $1.50 of direct labor. Annual manufacturing

  What problems does bill marlowe face

What problems does Bill Marlowe face and are the problems related to the way IWT is organized, or are they related to the employees?

  Problem regarding the nike core competency

Chapter case 4 (strategic management 2nd edition : Frank T Rothaermel) about Nike's core competency: The Risky Business of Fairy Tales

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd