1 / 8

Merge Sort (Analysis )

Introduction. Merge Sort (Analysis ). Design and Analysis of Algorithms I. Running Time of Merge Sort. Claim: For every input array of numbers, Merge Sort produces a sorted output array and uses operations. Proof of claim (assuming n = power of 2):.

shaw
Télécharger la présentation

Merge Sort (Analysis )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction Merge Sort (Analysis) Design and Analysis of Algorithms I

  2. Running Time of Merge Sort Claim: For every input array of numbers, Merge Sort produces a sorted output array and uses operations.

  3. Proof of claim (assuming n = power of 2):

  4. Roughly how many levels does this recursion tree have (as a function of n, the length of the input array)? A constant number (independent of n).

  5. Proof of claim (assuming n = power of 2):

  6. What is the pattern? Fill in the blanks in the following statement: at each level j=0,1,2,…,, there are <blank>subproblems, each of size <blank>. 2jand 2j, respectively.

  7. Proof of claim (assuming n = power of 2): At each level j=0,1,2,…, , there are 2jsubproblems, each of size n/2j.

  8. Running Time of Merge Sort Claim: For every input array of numbers, Merge Sort produces a sorted output array and uses operations.

More Related