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

  You work for centervale apparel a large clothing

you work for centervale apparel a large clothing manufacturing firm. centervale apparel has budgeted 9.7 million for

  Evaluate the likely impacts on the banking industry

Evaluate the likely impacts on the banking industry if the U.S. Congress fails to increase the debt ceiling resulting in an actual default on some U.S.

  Behavior of the firm and the industry

For this project, complete an economic analysis of the firm you selected. Include the following:

  What demand for premium gasoline for the next production

Allstate distributors indicated which the demand for the premium gasoline for the next production period would be at most 20,000 gallons.

  Explain how a new technology system should be implemented

Explain how a new technology system should be implemented and/or introduced to a company. Include your recommendations as if you were the manager in charge of implementing the new technology

  Broken in a customer service relationship

What happens when trust is broken in a customer service relationship? Can this trust be repaired?

  How does it relate to a database administrator

What is a relational database management system and how does it relate to a database administrator?

  Describe the structure of whs management system

Describe the structure of WHS management system most appropriate for this organisation.

  Different roles and activities commonly required for manager

1. What do you perceive are the different roles and activities commonly required for managers?

  Company new required rate of return

The risk-free rate and the firm's beta remain unchanged. What is the company's new required rate of return?

  Analyse the importance of financial planning in business

Analyse the importance of financial planning in business and explain the financial and legal aspects of financial planning activities in business

  Describe the sources and level of the conflict and support

Assignment: Conflict Identification and Resolution. Identify and describe the source(s) and level of the conflict and support with evidence.

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