Question

subject: Parallel and Distributed Computing Which of the sorting algorithm can you use for the array:...

subject: Parallel and Distributed Computing

Which of the sorting algorithm can you use for the array: 45, 21, 18, 13, 46, 32, 11, 2.

Homework Answers

Answer #1

Note: Here I am taking consideration that we have to sort the array in ascending order.

Best Case: if input array is already sorted in ascending order.

Worst Case: if input array is sorted in descending order.

Average Case: if input array is sorted Intermittent. like our question array

Here our input array will fall inside the average case. So we can use the Quick Sort algorithm, because the time of Quick Sort is O(n log n) in the best case, O(n log n) in the average case , and O(n^2) in the worst case. But because it has the best performance in the average case for most inputs, It is generally considered the “fastest” sorting algorithm.

Thanks if you need help plzz comment in the comment section.

Know the answer?
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
Similar Questions
Write an application in Java which includes an algorithm that takes an array of any size,...
Write an application in Java which includes an algorithm that takes an array of any size, selects the high and low integer from the array of integers with each pass and builds a new array of integers by inserting the high and low selection with each pass. Your output should show the original array of integers and the output of each pass on a new line. Note: You can assume all integers are positive, but your code must work for...
You are asked to write an efficient algorithm to search a given key within a given...
You are asked to write an efficient algorithm to search a given key within a given 2D array, where every row and column is sorted in an ascending order. For example consider a 2D arrary. Every row and column is sorted. You are searching the 2D array for key 36. 3 7 11 23 45 5 9 13 25 50 7 14 15 30 55 10 18 22 34 62 16 24 29 38 88 Present pseudocode of an efficient...
You are asked to write an efficient algorithm to search a given key within a given...
You are asked to write an efficient algorithm to search a given key within a given 2D array, where every row and column is sorted in an ascending order. For example consider a 2D arrary. Every row and column is sorted. You are searching the 2D array for key 36.   3 7 11 23 45 5 9 13 25 50 7 14 15 30 55 10 18 22 34 62 16 24 29 38 88 Present pseudocode of an efficient...
PLEASE CODE EVERYTHING IN C++ Quick Thinking: Arrays Objective: Test your knowledge in providing efficient solutions...
PLEASE CODE EVERYTHING IN C++ Quick Thinking: Arrays Objective: Test your knowledge in providing efficient solutions for operations on arrays. What you can use only: Loops These variables only const int SIZE = 4; int variable = 0, master array [SIZE][SIZE]; double average = 0.0, parallel array [SIZE]; One conditional statement per problem if needed Note: the conditional statement cannot contain an “else” or “else if’ Provide solutions to the following problem. Absolutely no hard coding can be used. ----------------------------------------------------------------------------------------------------------------------------------------------------------...
Suppose you can use a library that contains two familiar sorting functions: BUBBLESORT(A) and MERGESORT(A) Both...
Suppose you can use a library that contains two familiar sorting functions: BUBBLESORT(A) and MERGESORT(A) Both functions take as input an array A of length n and sort it. Their running times are O(n2) and O(n log n) respectively. The library also contains another sorting function, with the following pseudocode: - function STRANGESORT(A) - if (length(A)1000) then - return BUBBLESORT(A) - else - return MERGESORT(A) What is the worst-case running time of STRANGESORT? Please justify your answer.
Consumers Union provides ratings on a large variety of consumer products. They use sophisticated testing methods...
Consumers Union provides ratings on a large variety of consumer products. They use sophisticated testing methods as well as surveys of their members to create these ratings.     One recent article rated laundry detergents on a scale from 1 to 100. Here are the ratings along with the price per load, in cents, for 24 laundry detergents:     Rating Price (cents) 59 18 55 30 48 16 46 13 35 8 32 5 59 22 52 23 47 15 46...
The shellsort algorithm is described in detail in the Topic 4 lecture slides, as well as...
The shellsort algorithm is described in detail in the Topic 4 lecture slides, as well as Wikipedia (https://en.wikipedia.org/wiki/Shellsort). Write a function in C which implements the shell sort algorithm. The recommended approach is to create an array of sub arrays using dynamic memory allocation, sort those sub-arrays, and replace them in the array. This is achievable through the use of double pointers. The following may be helpful: https://www.geeksforgeeks.org/dynamically-allocate-2d-array-c/ Inputs: array -> a pointer to the integer array to be sorted...
You are asked to implement a C++ class to model a sorted array of unsigned integers....
You are asked to implement a C++ class to model a sorted array of unsigned integers. The class is to be used in an embedded application that cannot assume the presence of the STL. The array has to be dynamically allocated in such a way that allows programmers using it to specify the required size. Your class should should: (1) provide the appropriate constructors and destructor; (2) provide methods for updating, and showing numbers in/to the array (e.g., to be...
To detect the presence of harmful insects in farm fields, we can put up boards covered...
To detect the presence of harmful insects in farm fields, we can put up boards covered with a sticky material and examine the insects trapped on the boards. Which colors attract insects best? Experimenters placed six boards of each of four colors at random locations in a field of oats and measured the number of cereal leaf beetles trapped. Conduct a regression analysis. What is the estimated standard error of the model (2 decimal places)? Blue Green White Red 16...
Use Stats Disk if needed!! Question= Based on this data, create an interval for which we...
Use Stats Disk if needed!! Question= Based on this data, create an interval for which we would consider it "usual" for a randomly selected participant to fall within. 1-6 2-1 3-1 4-4 5-6 6-8 7-2 8-2 9-4 10-5 11-7 12-10 13-6 14-3 15-2 16-1 17-Something ............. 18-1 19-2 20-3 21-5 22-7 23-8 24-2 25-3 26-2 27-2 28-4 29-3 30-4 31-6 32-1 33-1 34-6 35-4 36-4 37-3 38-1 39-1 40-5 41-8 42-1 43-7 44-9 45-2 46-9 47-7 48-8 49-4 .......... 50-2
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT