Question

Assume that the following 8 numbers are elements of an array (7pt). 8, 7, 6, 5,...

Assume that the following 8 numbers are elements of an array (7pt).

8, 7, 6, 5, 4, 3, 2, 1.

  1. Sort the array in ascending order by applying Merge sort, and show how the array looks after each step.
  2. Is merge sort has every-case time complexity? If your answer is yes, what is its every-case time complexity?
  3. If your answer is no, what is its worst case time complexity and at what condition it will have worst-case time complexity?
  4. If your answer is no, what is its best- case time complexity and at what   condition it will have best-case tie complexity?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

sub parts c and d are not required in merge sort

Because time complexity in all cases are equal O(nlogn)

Anything doubtful or not understand or missing just comment

Don't be dislike

Thank you and all the best

Add a comment
Know the answer?
Add Answer to:
Assume that the following 8 numbers are elements of an array (7pt). 8, 7, 6, 5,...
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
  • Let us suppose that there are n elements in the un-sorted array. Answer the following? q1:...

    Let us suppose that there are n elements in the un-sorted array. Answer the following? q1: How is merge sort different from quick sort? q2: What is the split ratio in merge sort? q3: What is the worst-case/average-case/best-case running time of Merge Sort? q4: Why is the worst case running time of Merge sort O(n log n) always? q5: Why does Merge Sort use a static tree in the recursion process? (It is worth noting that the Quick Sort use...

  • 6 6. Merge Bubble Sort: a) How does the merge bubble sort break the array into...

    6 6. Merge Bubble Sort: a) How does the merge bubble sort break the array into sublists? b) What does it need to use for each sublist and then what does it do with all of the sublists? c) What is the Big-O notation for this sort? 7. Merge Sort: a) How does the merge sort use recursion to break the array into sublists? b) What happens to each of these sublists to get the final sorted list? c) What...

  • 7. (14 points) Use LSD-first Radix Sort algorithm to sort the following array of numbers. Write...

    7. (14 points) Use LSD-first Radix Sort algorithm to sort the following array of numbers. Write the worst case, the best case time complexity and discuss if these sorting algorithms are stable and in-place? In what cases using these algorithms would not be efficient? (You must run Counting Sort for each digit explicitly.) A=[22,15,16,13,23,45,0,23,123]

  • Sort the same array [3, 5, 1, 4, 8, 7,9, 2] in the ascending order by...

    Sort the same array [3, 5, 1, 4, 8, 7,9, 2] in the ascending order by applying the Merge sort algorithm. Write down the intermediate results step by step in a tree structure. (20 points)

  • Given the array A = (5, 7, 14, 8, 11, 15, 9, 13, 12, 10), show...

    Given the array A = (5, 7, 14, 8, 11, 15, 9, 13, 12, 10), show how the Insertion sort and Quicksort algorithms work. Step through each algorithm, illustrating how it modifies the input array A. State the worst- and best-case computational complexity of the two algorithms in terms of the size |A| of the input array, and explain why.

  • Given an unsorted array. The array has this property that every element in array is at...

    Given an unsorted array. The array has this property that every element in array is at most k distance from its position in sorted array where k is a positive integer smaller than size of array. Which sorting algorithm can be easily modified for sorting this array and what is the obtainable time complexity? Group of answer choices nsertion Sort with time complexity O(kn) Heap Sort with time complexity O(nLogk) Quick Sort with time complexity O(kLogk) Merge Sort with time...

  • 2.1 Searching and Sorting- 5 points each 1. Run Heapsort on the following array: A (7,3, 9, 4, 2,5, 6, 1,8) 2. Run merge sort on the same array. 3. What is the worst case for quick sort? What is...

    2.1 Searching and Sorting- 5 points each 1. Run Heapsort on the following array: A (7,3, 9, 4, 2,5, 6, 1,8) 2. Run merge sort on the same array. 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. Gi pseudocode for an algorithm that will solve the following...

  • Please answer in Java for an immediate upvote :) Given the following array of 8 elements,...

    Please answer in Java for an immediate upvote :) Given the following array of 8 elements, trace the merge sort algorithm. Assume the array is to be sorted in ascending order.                        81          16          4        6             34          11          23        67 ANSWER: (Hint 6 – lines): Why don’t we select the median element of all the n-entries in the array to be our pivot point? ANSWER:

  • Given an array of numbers, you want to find out the three greatest numbers. Do you...

    Given an array of numbers, you want to find out the three greatest numbers. Do you have to sort the array, or is there a faster way than applying a sorting algorithm? Explain why you use or not use sorting in terms of the worst-case running time. Give an example.

  • Data Structures: Suppose we sort an array of numbers, but it turns out every element of...

    Data Structures: Suppose we sort an array of numbers, but it turns out every element of the array is the same, e.g., {17, 17, 17, ..., 17}. (So, in hindsight, the sorting is useless.) (a) What is the asymptotic running time of insertion sort in this case? (b) What is the asymptotic running time of selection sort in this case? (c) What is the asymptotic running time of merge sort in this case? (d) What is the asymptotic running time...

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