Compute the total number of comparisons used to sort

Assignment Help Data Structure & Algorithms
Reference no: EM131379742

1. The file contains all of the integers between 1 and 10,000 (inclusive, with no repeats) in unsorted order. The integer in the ith row of the file gives you the ith entry of an input array.

Your task is to compute the total number of comparisons used to sort the given input file by Quicksort. For this part you should always use the first element of the array as the pivot element.

You should not count comparisons one-by-one. Rather, when there is a recursive call on a subarray of length m, you should simply add m-1 to your running total of comparisons.

2. Compute the number of comparisons (as in Part 1), always using the final element of the given array as the pivot element.

3. Compute the number of comparisons (as in Part 1), using the "median-of-three" pivot rule.

In more detail, you should choose the pivot as follows. Consider the first, middle, and final elements of the given array. If the array has odd length it should be clear what the middle element is. For an array with even length 2k, use the kth element as the middle element. So for the array 4 5 6 7, the middle element is the second one - 5 and not 6. Identify which of these three elements is the median, and use this as your pivot.

Reference no: EM131379742

Questions Cloud

Explain the process once she gets to the us : Go to the USCIS website and find the initial USCIS application/form that Frank must complete to begin the process of bringing his finance over from France. What is the name of the Visa she will use to come over? Explain the process once she gets t..
Did court agree that gulf breached its contract : Did the American court have jurisdiction over an exclusively American contract affected by an international incident, such as the 1973 oil embargo? Did the court agree that Gulf breached its contract with Eastern Airlines? Explain.
What are advantages of java as compared to the other two : What are the advantages and disadvantages of Java as compared to the other two? Your report should include a use case describing the career path of a Java developer in the IT industry.
Why was the court involved in this scenario : Assess whether this was a constitutional or unconstitutional delegation of power. Why was the court involved in this scenario? Why is this case significant for public administrators in understanding the delegation doctrine
Compute the total number of comparisons used to sort : Your task is to compute the total number of comparisons used to sort the given input file by Quicksort. For this part you should always use the first element of the array as the pivot element.
Explain was arkansas correct in the given situation : Arkansas argued that the federal district court had no extraterritorial power to mediate this international trade dispute. Was Arkansas correct? Explain.
What percentage of these movies were comedies : Which of the following can you learn from this table? Give the answer if you can find it from the table. i) The percentage of PG-13 movies that were comedies
Case brief - oberschlake vs veterinary animal associates : Complete a case brief for Oberschlake v. Veterinary Animal Associates. We have read through this case before so you should know it well at this point. Come prepared with the brief by the date indicated on the calendar
Identify unknown vocabulary and technical terms : Does it present research on an important topic that has not yet been studied to any real extent? Articles of this type may present new research or the analysis and translation of a significant primary source.Is the author presenting new research a..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Design algorithm that computes how many steps it will take

Will the viruses eventually kill all the bacteria? If so, design an algorithm that computes how many steps it will take. How does the running time of your algorithm depend on n?

  Calculate the size of the state space as a function of n

n vehicles occupy squares (1, 1) through ( n , 1) (i.e., the bottom row) of an n × n grid. The vehicles must be moved to the top row but in reverse order

  Write a program that uses a recursive algorithm to compute

Write a program that uses a recursive algorithm to compute the determinant of a maxtrix. It should read a matrix, print it out, and compute and print the determinant.

  Draw the hierarchy chart and then plan logic for a program

Draw the hierarchy chart and then plan the logic for a program for the sales manager of The Couch Potato Furniture Company. The manager needs a program to determine the profit on any item sold

  Lines of action- explain how you will use a search tree to

lines of action- explain how you will use a search tree to find the solutionbullabstractbullintroductionbullrelated

  Determine order of operations for seq search algorithm

Determine the order of operations for this Seq Search algorithm. Best case and worse case and why - Find the order of operations for this Search algorithm. Prepare a proper algorithm for this problem and how to complete it.

  Ease of changes in the processing algorithms

Ease of changes in the processing algorithms: For example, line shifting can be performed on each line as it is read from the input device, on all the lines after they have been read, or on demand when the alphabetization requires a new set of shi..

  Do you observe any changes in cluster memberships

Draw the graphic for the healthy set, representing the values, healthy and unhealthy and what is the degree of membership to the fuzzy set healthy of person B who has a BMI of 26.2? And to the fuzzy set unhealthy?

  Clarify analysis what sort of people were likely to survive

In this challenge, we ask you to complete the analysis of what sorts of people were likely to survive. In particular, we ask you to apply the tools of machine learning to predict which passengers survived the tragedy.

  Object identifier tree

Assume you worked for a United States based corporation that wanted to develop its own MIB for managing a product line. Where in the object identifier tree would it be registered?

  Determine storage required for bfs and dfs

Determine the minimum number of nodes expanded and storage required for BFS and DFS? (Hint: this question asks about the best case performance of BFS and DFS).

  A and b, both of which perform the same function

Assume you have two algorithms, A and B, both of which perform the same function,

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