Question

For a list of length n, insertion sort makes _key comparisons, in the worst case. None of these O(nlogzn) On O) O() Question
0 0
Add a comment Improve this question Transcribed image text
Answer #1

                       ANSWER : HERE IS THE ANSWER FOR YOUR QUESTION:

  

                       ------------------------------------------------------------------------------------------------------

Question 1) insertion sort is the algorithm in which the comparision is done between the element of the list and the the element are keep on inserted at thier correct order in sorted form

in worst case , that is when the list is reversely sorted , the algorithm would make o(N ^2) comparisions

thus , the correct option is  

4) O(n^2)

Question 2) worst case of the quick-sort algorithm is when we select the left-most element of the list as pivot and also any of the below condition is true:

1) list is already sorted

2) list is reversely sorted

thus , the worst case complexity is o(n^2) and average case is o(n log n)

thus , the correct option is

c) o(n^2) and o(n log(n))

-------------------------------------------------------------------------------------------------------

I hope this would help you out.

If you like my answer , please upvote

If you have any doubt, you can provide comment /feedback below the answer

Thanks

Add a comment
Know the answer?
Add Answer to:
For a list of length n, insertion sort makes _key comparisons, in the worst case. None...
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
  • About how many comparisons would the binary search makes if the list is of length 1...

    About how many comparisons would the binary search makes if the list is of length 1 million and the search item is not in the list? 500,000 comparisons 1 million comparisons 20 comparisons None of these 1 thousands comparisons D Question 18 2 pts The time complexity of the merge sort is in the worst case and in the average case (1), () Orlogan), Oorlog) Orlogo"). (1) 001), O(nlogon) (r). (1)

  • Insertion sort on small arrays in merge sort Although merge-sort runs in Θ(n log n) worst-case...

    Insertion sort on small arrays in merge sort Although merge-sort runs in Θ(n log n) worst-case time and insertion sort runs in Θ(n 2 ) worst-case time, the constant factors in insertion sort can make it faster in practice for small problem sizes on many machines. Thus, it makes sense to coarsen the leaves of the recursion by using insertion sort within merge sort when subproblems become sufficiently small. Consider a modification to merge sort in which n/k sublists of...

  • Suppose running mergesort on a takes 54 seconds in the worst case to sort a list...

    Suppose running mergesort on a takes 54 seconds in the worst case to sort a list of size 2^(18) . Taking the time complexity to be of the form Cnlog(n) calculate C and thus calculate the maximum time it would take to sort a list of the size 2^20 .

  • Insertion Sort Which are true of Insertion Sort (traditional implementation, without optimizations)? Multiple answers:You can select...

    Insertion Sort Which are true of Insertion Sort (traditional implementation, without optimizations)? Multiple answers:You can select more than one option. Please, include the explanation with the answer. A) It uses Θ(n^2) comparisons in the worst case B) It uses Θ(n^2) comparisons in the average case C) It uses Θ(n^2) comparisons in the best case D) It uses Θ(n^2) movements of elements in the worst case E) It uses Θ(n^2) movements of elements in the average case F) It uses Θ(n^2)...

  • List the worst case and average case Big O for each algorithm below and describe how...

    List the worst case and average case Big O for each algorithm below and describe how the algorithm works. You can diagram or write a short paragraph. Bubble Sort Modified Bubble Sort Insertion Sort Merge Sort Selection Sort Shell Heap Quick

  • Worst-case complexity of quicksort is similar to the every-case complexity of exchange sort. Average-case time complexity...

    Worst-case complexity of quicksort is similar to the every-case complexity of exchange sort. Average-case time complexity of quicksort is as good as worst-case time complexity of mergesort. Similar to quicksort, mergesort uses a pivot to partition the input array. Select one: True False

  • Solve ques no. 2 a, b, c, d . Algorithm 1 Sort a list al,..., an...

    Solve ques no. 2 a, b, c, d . Algorithm 1 Sort a list al,..., an for i=1 to n-1 do for j=1 to n-i do if aj > aj+1 then interchange a; and a;+1 end if end for end for (b) Algorithm 1 describes a sorting algorithm called bubble sort for a list al,...,an of at least two numbers. Prove that the algorithm is complete, correct and terminates. (2) Complexity of Algorithms (Learning Target C2) (a) What is the...

  • THESE ARE TRUE/FALSE The best-time complexity for insertion sort is O(nlogn). The worst-time complexity for bubble...

    THESE ARE TRUE/FALSE The best-time complexity for insertion sort is O(nlogn). The worst-time complexity for bubble sort is O(nlogn). A linked structure consists of nodes. Each node is dynamically created to hold an element. All the nodes are linked together to form a list. The time complexity for searching an element in a binary search tree is O(logn) The time complexity for inserting an element into a binary search tree is O(logn). In an AVL tree, the element just inserted...

  • (Selection Sort). Selection sort finds the largest number in the list and places it last. It...

    (Selection Sort). Selection sort finds the largest number in the list and places it last. It then finds the largest number remaining and places it next to last, and so on until the list contains only a single number. Describe the selection sort algorithm in pseudocode What is the worst-case time complexity (w.c.t.c) of the selection sort in terms of the number of comparisons made? What is the exact order complexity of the selection sort algorithm? Explain.

  • The time-complexity of searching an AVL tree is in the worst case and in the average...

    The time-complexity of searching an AVL tree is in the worst case and in the average case. On), On) O(logot). O(log O ON), C(n) 0(), O(log) Question 16 2 pts The time-complexity of searching a binary search tree is in the worst case and in the average case (1), O(log) O(logn), O(log,n) On), On) 001), 001)

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