Question

a. We studied several sorting algorithms. Every sorting algorithm has their own special reason where it can only use. Can you

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

(a) (i) Insertion Sort:

In case of the following scenarios, insertion sort is the best sorting algorithm:

(1) When the input array is almost sorted (only a few out of order elements).

(2) When the array size is small.

(ii) Selection Sort:

In case of the following scenarios, selection sort is the best sorting algorithm:

(1) When there are big number of records.

(2) Available memory space is limited.

(3) The given array is already sorted.

(iii) Merge Sort:

In case of the following scenarios, merge sort is the best sorting algorithm:

(1) When parallel threading or multi-programming support is required.

(2) When linked list sorting is required.

(3) When the given array is sorted in the reverse order.

(iv) Quick Sort:

In case of the following scenarios, quick sort is the best sorting algorithm:

(1) When array sorting is required.

(2) When fast (quick) sorting is required.

The given question has two questions included in it. As per the HOMEWORKLIB RULESs I have answered the first question and requesting you to re-post the remaining question as a separate one.
Please comment in case of any doubt.
Please upvote if this helps.

Add a comment
Know the answer?
Add Answer to:
a. We studied several sorting algorithms. Every sorting algorithm has their own special reason where it...
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...

  • Inal Examination 17. Which of the sorting algorithms listed below has the time fastest best case...

    Inal Examination 17. Which of the sorting algorithms listed below has the time fastest best case run (a) Heap sort (b) Merge sort (c) Quick sort (d) Insertion sort 18. Which statement below is false: (a) Quick uick sort and merge sort are divide and conquer algorithte (b) Counting sort is a linear time sorting algorithm. (e) Insertion sort and quicksort have similar best case (d) Generic minimum spanning tree algorithm is 19. Counting sort and radix sort are linked...

  • Implement and compare sorting algorithms. The task is to sort a list of integers using 5...

    Implement and compare sorting algorithms. The task is to sort a list of integers using 5 sorting algorithms: selection sort insertion sort merge sort heap sort quicksort Your program should include 5 separate sorting methods, though it is fine for them to call some common methods (like "swap") if needed. Each sorting method should also count the number of comparison operations and assignment operations on the array elements during the sorting process. In the main program, two types of array...

  • 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...

  • For java review please help #2 2. (15 points (-14+1)) Compare the execution complexity of sorting...

    For java review please help #2 2. (15 points (-14+1)) Compare the execution complexity of sorting algorithms. Worst Case Average Case Selection Sort (2.1) Bubble Sort (2.2) Insertion Sort (2.3) Radix Sort Merge Sort Quicksort Heap Sort (2.8) (2.9) (2.10) (2.4) (2.5) (2.6) (2.7) (2.12) (2.13) (2.14) 3. (10 points) Answer the following questions for an array based representation of a complete binary tree (say the array name is binTree). (3.1) root of tree bin Tree LoT

  • Java We did in lecture, and explain your answer briefly. Problem 4: Sorting practice 14 points;...

    Java We did in lecture, and explain your answer briefly. Problem 4: Sorting practice 14 points; 2 points for each part individual-only Important: When answering these questions, make sure to apply the versions of these algorithms that were discussed in lecture. The Java code for each algorithm can be found in our Sort class. Given the following array: {14, 7, 27, 13, 24, 20, 10, 33 1. If the array were sorted using selection sort, what would the array look...

  • 3. (8 points) Using the implementation of binary search tree operations we discussed in class, draw...

    3. (8 points) Using the implementation of binary search tree operations we discussed in class, draw the trees that result from the following operations: (a) Inserting 142, 400, 205, 127, 100, 320, 160, 141, and 110 into an initially-empty tree (in that order). (b) Deleting 142 from the tree you drew for part (a). 4. (8 points) Draw the unique binary tree that has a preorder traversal of 4, 1, 6, 3, 7, 5, 9, 2, 8 and an inorder...

  • //Generic interface that describes various searching and sorting //algorithms. Note that the type parameter is unbounded....

    //Generic interface that describes various searching and sorting //algorithms. Note that the type parameter is unbounded. However, //for these algorithms to work correctly, the data objects must //be compared using the method compareTo and equals. //In other words, the classes implementing the list objects //must implement the interface Comparable. The type parameter T //is unbounded because we would like to use these algorithms to //work on an array of objects as well as on objects of the classes //UnorderedArrayList and...

  • Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers...

    Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...

  • A test harness program for testing sorting methods is provided with the rest of the textbook...

    A test harness program for testing sorting methods is provided with the rest of the textbook program files. It is the file Sorts.java in the ch11 package. The program includes a swap method that is used by all the sorting methods to swap array elements. Describe an approach to modifying the program so that after calling a sorting method the program prints out the number of swaps needed by the sorting method. Implement your approach. Test your new program by...

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