CST370 Design and Analysis of Algorthms Week 4

Week 4 is a short week and only few things was discussed. In particular this week we learn about merge sort. Merge sort basic idea is to split the input into two halves. Sort the first half of the input recursively. Sort the second half of the input array recursively. Then merge the two sorted halves together. Merge sort uses the divide and conquer technique to sort an input array with n elements. During the time analysis of merge sort, using master Theorem, it shows that the case is O(n log n). Since the recurrence relation T(n) = 2* T(n/2) + n-1 which is 2* T(n/2) + O(n). With master theorem a = 2, b = 2 and d = 1. This relation shows that a = b^d which is 2 = 2^1 which shows that it is O(nlogn).

Other than that I basically had a review with everything from week 1 to week 3. Week 4 is midterm that is why it is short. Basically re-learn everything that I learned in the past plus the new Merge Sort concept.

Comments

Popular posts from this blog

Week 4

Week 5

Week 2