Question

(5 marks; questions to Reza) In Lecture 5, Travis said you can prove QuickSort takes N(n log n) time in the best case the sam

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

I have completed this problem.Please give thumbs up.

Step1

sorted Bauted Mewuge tuto soubed paullo Memerge sant Algorithm [fuely Dand c] bines assay of n elemento a [low . - nigh] arra

Step 2

1 Bi Menge (low, mid, high) => cn yr an / Sarted Algo Meurge ( low, mid, nigh) { I Menge two souted any ays a [low.. wig 44.Step3

Date Page No.: for (x=low ; x = nig Wjx+1) in urt 9 [x] = b[x]; Sa 2 4 V v 6 1 20) 2 4 3 12 8 910 b2418 15 5 10 12 10 2 3 414Step4

Date Page No.: masth. 1 4 5 6 9 2 3 a 20 10 18 5 2 10 Ims (115) 1 8 15 25 10 3 ms (6:10) 6 1 8 9 10 1011525 1013 m3 664 mis 1Step 5

Mengesayt time complexity recussence vern - 8T(%) ton In>1 In=1 =on olm logo? | All cases BC, WE HAC Depth of Recuusiow : 0 (Step 6

e Quick sayt Algouithm Plaus pillor elemente into cay cheat position] widey und saying algovitom Implace souting but not stabStep7

Page No.: Date { nelemente Algo Quicksort (low, high? Il a flow.... nigh ar way of is (low high) Il more than one element j=Step 8

Date Page No.: nigh) =) oln) n ou { 1. do -Аао рамзин оо(o lov, izlow ; j= high tlj @[highti] = +00;} X = a[low ]; pivot. doStep 9

نی نی نی Date || 2 SS ام I6o 3s ( 8e3c ة 85 ام) 10 2090 + 80 20 40 4o 60 55 ا وم و ۱o 8 | ssl 3o| 20 | 30| 40 | 65 | 4 | 85 |Step 10

Date Page No.: complexity of Quressort worst cave time complexity Quick saył behaues Wc jf input au chay in sarted auder. alrStep 11

Date _ Page No.: Tin - on 2 Max depth of weeussiow of quicksoot! oln). 2 lest Best case time complexity of Quick sort :- stsStep 12

case To Aug of quick sort :- ayway of elemente each time pautition algorithm dinide list into two Bilbproblem with n + 4n eleStep 13

Date Page No.: Insertion saut Algo :-(inplace th Stable) idea: Place a ligj alij element into canneet position of sauted partStep 14

Date 1 2 3 24 25 ParaTS/10/15/ ३० 25 Algo Insertionsaut (ein) { faylist;i<n-1; i++) item = a [i+1] ; jeż; while lj>ft abjj >Step 15

Page No.: Time complexity Pass min comp ff min max tt max Avg HAVO amway ships comp assay compom Shirt Pass 1 1 tto L Ifft Pa

Add a comment
Know the answer?
Add Answer to:
(5 marks; questions to Reza) In Lecture 5, Travis said you can prove QuickSort takes N(n...
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
  • 1.3 ​Which of the following is true about sorting functions?A.The most optimal partitioning policy for quicksort...

    1.3 ​Which of the following is true about sorting functions?A.The most optimal partitioning policy for quicksort on an array we know nothing about wouldbe selecting a random element in the array.B.The fastest possible comparison sort has a worst case no better than O(​n​ log ​n​).C.Heapsort is usually best when you need a stable sort.D.Sorting an already sorted array of size ​n​ with quicksort takes O(​n​ log ​n​) time.E.When sorting elements that are expensive to copy, it is generally best 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...

  • Canvas →XC 6 D Question 10 5 pts When sorting n records, Quicksort has worst-case cost...

    Canvas →XC 6 D Question 10 5 pts When sorting n records, Quicksort has worst-case cost On) On 2) On logn) Olm Question 11 5 pts In the worst case, the very best that a comparison based sorting algorithm can do when sorting n records is On 2) Allog in! (n) (login) Question 12 5 pts An AVL tree is a Binary Search Tree that has the following additional property none of the above for every node in the tree....

  • 4. [30 pts:10+9+11] a) You are given traffic data (number of page hits) for n websites for some time period. (n is a large number, in the order of hundreds of thousands.) You are asked to print t...

    4. [30 pts:10+9+11] a) You are given traffic data (number of page hits) for n websites for some time period. (n is a large number, in the order of hundreds of thousands.) You are asked to print the top k websites with greatest amount of traffic (k is much smaller than n). Which of insertion sort, mergesort quicksort, or heapsort may be used to devise the fastest (in worst case) algorithm for this task? What would be its worst case...

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

  • C++ Question 9 5 pts Deleting the minimum element in a min-heap of N elements takes...

    C++ Question 9 5 pts Deleting the minimum element in a min-heap of N elements takes in average case O(N log N) O(1) O(N) Oſlog N) D Question 10 5 pts The time taken to find an element in an AVL tree of depth d is Old) 02) Oſlog d) Old log d) Question 11 5 pts Secondary clustering in a hash table occurs when using Linear probing Separate chaining Quadratic probing Double hashing Question 12 5 pts When sorting...

  • 4. [30 pts; 10+9+11] a) You are given traffic data (number of p large number, in the order of hundreds of thousands.) with greatest amount of traffic (k is much smaller than n). Which of inserti...

    4. [30 pts; 10+9+11] a) You are given traffic data (number of p large number, in the order of hundreds of thousands.) with greatest amount of traffic (k is much smaller than n). Which of insertion sort, m quicksort, or heapsort may be used to devise the fastest (in worst case) algorithm for this task? What would be its worst case big O running time, in terms of n and k? (Note: it as soon as you get the top...

  • [Code in C] Help me with this. Not sure what to do. 1 Couting Sort You...

    [Code in C] Help me with this. Not sure what to do. 1 Couting Sort You may have learned some sorting algorithms - such as bubble sort ad quicksort in CS 110 and CS 210. This homework is about counting sort. Let n be the number of elements to be sorted. Bubble sort and quicksort assume tha time, which one is larger and which one is smaller. They make no assumption on the values of the elements t we can...

  • JAVA 3 LECTURE REVIEW PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!! Question 12 points The...

    JAVA 3 LECTURE REVIEW PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!! Question 12 points The best-case performance for a shell sort is: --- O(1) O(n2)   O(n) O(n log n)   Signaler cette question Question 22 points The best-case performance for an array of n items using insertion sort is: --- O(n2)   O(n) O(1) there is no best-case Signaler cette question Question 3 2 points A recursive method that processes a chain of linked nodes --- uses the first node in...

  • JAVA 3 PLEASE ANSWER AS MANY QUESTIONS AS POSSIBLE! ONLY 2 QUESTIONS LEFT THIS MONTH!!! Question...

    JAVA 3 PLEASE ANSWER AS MANY QUESTIONS AS POSSIBLE! ONLY 2 QUESTIONS LEFT THIS MONTH!!! Question 12 pts Which is a valid constructor for Thread? Thread ( Runnable r, int priority ); Thread ( Runnable r, String name ); Thread ( int priority ); Thread ( Runnable r, ThreadGroup g ); Flag this Question Question 22 pts What method in the Thread class is responsible for pausing a thread for a specific amount of milliseconds? pause(). sleep(). hang(). kill(). Flag...

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