Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. For each of the following situations, state the sorting algorithm from the list (Selection Sort, Merge Sort, Insertion Sort, Bubble Sort) that best solves
4. For each of the following situations, state the sorting algorithm from the list (Selection Sort, Merge Sort, Insertion Sort, Bubble Sort) that best solves it. (For some questions, more than one answer might be acceptable, but you only need to write the most suitable.) [8 marks] A. You are sorting data over a network connection: the algorithm/code runs on your computer, but the data resides on a remote location. Since the network connection is very slow, it is extremely expensive to "swap" two elements from the collection. But looping over the elements and looking at their values is very inexpensive. You need to minimize swaps above all other factors, A good choice would be: sort. B. I have a fast computer with many processors and lots of memory. I want to choose a sorting algorithm that is fast and can also be parallelized easily to use all of the processors to help sort the data. A good choice would be: sort. C. I have an array that is already sorted. Periodically, a new data item comes in and is added to the array at random index, messing up the ordering. I need to re-sort the array to get it back to being fully ordered. I do not want to use very much additional memory during the sort. A good choice would be sort. D. We are working on an unstable system. When we try to run our sort on large arrays, sometimes the sorting algorithm will be forced to stop running in the middle of execution. (The array will be left in whatever state it was in at the time the algorithm stopped.) But we can start the algorithm over and run it again later. So we want to choose an algorithm that will make progress toward the goal even if it does not always finish executing. A good choice would be: sort
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started