Question

Data Structures: For each of the following situations, name the best sorting algorithm we studied. (For...

Data Structures:

For each of the following situations, name the best sorting algorithm we studied. (For one or two questions, there may be more than one answer deserving full credit, but you only need to give one answer for each.)

(a) The array is mostly sorted already (a few elements are in the wrong place).

(b) You need an O(n log n) sort even in the worst case and you cannot use any extra space except for a few local variables.

(c) The data to be sorted is too big to fit in memory, so most of it is on disk.

(d) You have many data sets to sort separately, and each one has only around 10 elements.

(e) You have a large data set, but all the data has only one of about 10 values for sorting purposes (e.g., the data is records of elementary-school students and the sort is by age in years).

(f) Instead of sorting the entire data set, you only need the k smallest elements where k is an input to the algorithm but is likely to be much smaller than the size of the entire data set.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a) Insertion Sort

(b)Heap Sort

(c) Merge sort

(d)Insertion sort

(e)Bucket sort

(f)Selection sort

Add a comment
Know the answer?
Add Answer to:
Data Structures: For each of the following situations, name the best sorting algorithm we studied. (For...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Sorting: (40 points) a. We studied several sorting algorithms. Every sorting algorithm has their own special...

    Sorting: (40 points) a. We studied several sorting algorithms. Every sorting algorithm has their own special reason where it can only use. Can you explain carefully in which situation the following algorithms would be best sorting algorithm to use in an application. (10 points) i. Insertion sort ii. Selection sort iii. Merge sort iv. Quick sort b. You are given a string of elements as below, Canopus, Mimosa, Betelgeuse, Deneb, Stars, Pollux, Antares, Sirius, Hader i. Your task is to...

  • a. We studied several sorting algorithms. Every sorting algorithm has their own special reason where it...

    a. We studied several sorting algorithms. Every sorting algorithm has their own special reason where it can only use. Can you explain carefully in which situation the following algorithms would be best sorting algorithm to use in an application. (10 points) i. Insertion sort ii. Selection sort iii. Merge sort iv. Quick sort b. You are given a string of elements as below, Canopus, Mimosa, Betelgeuse, Deneb, Stars, Pollux, Antares, Sirius, Hader i. Your task is to insert the above...

  • 1.3 ​Which of the following is true about sorting functions?A.The most optimal partitioning policy for quicksort...

    1.3 ​Which of the following is true about sorting functions?A.The most optimal partitioning policy for quicksort on an array we know nothing about wouldbe selecting a random element in the array.B.The fastest possible comparison sort has a worst case no better than O(​n​ log ​n​).C.Heapsort is usually best when you need a stable sort.D.Sorting an already sorted array of size ​n​ with quicksort takes O(​n​ log ​n​) time.E.When sorting elements that are expensive to copy, it is generally best to...

  • Java Match the sorting algorithm with its time complexity, where n is the number of elements...

    Java Match the sorting algorithm with its time complexity, where n is the number of elements in the collection and k is the range of values. (This is a one-for-one match where an answer can only match one description.) Group of answer choices selection sort       [ Choose ]            O(n + k)            O(n) to O(n^2)            O(n log n)            O(n^2)       bubble sort       [ Choose...

  • You are working as the software developer and need to identify the best sorting algorithm. Please...

    You are working as the software developer and need to identify the best sorting algorithm. Please refer to the following URL: https://www.geeksforgeeks.org/sorting-algorithms/ You can pick any two-sorting algorithm. You need to determine which sorting algorithm is the best to sort the array of 10k elements. Use the following steps to help with your solution: Create C++ functions for any two-sorting algorithm. Write down the random array generation function to generate at least 10k elements. Pass the same array into both...

  • Algorithms and Basic Data Structures

    This part involves finding a new algorithm by yourself. You do NOT have to implement it with C++. You may just state the algorithm in pseudo-code. The problem is as follows: You have an integer array of n elements. You want to return true if there is a set of more than n/2 elements in the array with the same value, false otherwise. Notice that if the array is sorted (that is you are allowed to use a sorting algorithm),...

  • please I need it urgent thanks algorithms 2.1 Searching and Sorting- 5 points each 3. What is the worst case for quick sort? What is the worst case time com- plexity for quick sort and why? Ex...

    please I need it urgent thanks algorithms 2.1 Searching and Sorting- 5 points each 3. What is the worst case for quick sort? What is the worst case time com- plexity for quick sort and why? Explain what modifications we can make to quick sort to make it run faster, and why this helps. 4. Give pseudocode for an algorithm that will solve the following problem. Given an array AlL..n) that contains every number between 1 and n +1 in...

  • c++ data structures please Pick any inefficient sorting algorithm you want, selection, bubble, insertion, etc., and...

    c++ data structures please Pick any inefficient sorting algorithm you want, selection, bubble, insertion, etc., and implement it as a function. Using the system clock as a timer, determine when the efficiency of the algorithm breaks down. For example, does it become slow after 1000 elements, 10000 elements, 100000 elements? Write some code to figure this out. Then use the sort() algorithm that is part of the STL <algorithm> library. How does this function compare to the function you implemented?...

  • I need the report like this (idea) *Sorting Algorithms: A sorting algorithm is an algorithm that...

    I need the report like this (idea) *Sorting Algorithms: A sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists; it is also often useful for canonical zing data and for producing human-readable output. More formally, the output must satisfy...

  • 2. Here is a sorting algorithm that I like to use. Given an unsorted list of...

    2. Here is a sorting algorithm that I like to use. Given an unsorted list of size n, let Xx represent the data in location k of the unsorted list. Compare xi to X2 and switch if necessary so that they are in sorted order, smallest first. Compare Xn-1 and Xn and switch if necessary so that they are in sorted order, smallest first. • Compare x3 with its left neighbors, switching if necessary so that the 3 first entries...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT