DAT600: Sorting Algorithms and Running Times - Find-Max-Subarray - Engineering Assignment Help

Download Solution Order New Solution
Internal Code: 3IIA

Engineering Assignment Help

Task: 1 Running Times For a given problem with input size n, algorithms A, B, C are executed. In terms of running time, one of the algorithms is O(n), another is O(n log n) and the third is O(n2). Some measured running times of these algorithms are given below: Engineering Identify which algorithm has which big-Oh running time and explain your answer. 1.2) Calculate big-Oh running time, in terms of n, of the algorithm D shown below: Algorithm D (n) { s = 0; for i = 1 to n -1, for j = n downto 1 in steps j = j / 2, s = s + i*j; return s; } Task: 2 Algorithm Design Let E = {e1, e2, ..., en} be a sequence of integers. We say that an integer x forms a majority in E if x appears more than floor(n/2) times in E. For instance, the integer 3 is a majority in sequence E = {2, 3, 3, 2, 3, 3}, whereas the sequence E = {6, 3, 2, 7, 3, 1} has no majority. Assume that for each i, we have 1 ? ei ? k, where k is an integer. Describe an algorithm, with O(n + k) running time, which decides if E has a majority. Task: 3 Master Theorem Using the Master theorem, find the running time (Big-O) of the following algorithms: 3.1) Merge sort is a classical recursive divide-and-conquer algorithm for sorting an array. The algorithm splits the array in half, recursively sorts the two halves, and then merges the two sorted sub-arrays into the final sorted array. Time taken for the algorithm can be denoted as: Engineering 3.2) Time taken for the Karatsuba’s multiplication algorithm is given by the following recurrence equation: Engineering Task: 4 Understanding how “Find-Max-Subarray” and “Quicksort” works 4.1) Show step-by-step, how the procedure “find-max-subarray” determines the maximum subarray of the following row of numbers: A = [10 -2 8 -7 13 23 -18 14 24 8 -10 8] 4.2) Show step-by-step, how quicksort sorts the following row of numbers: A = [10 2 8 7 13 23 18 14 24 8]
This DAT600: Engineering Assignment has been solved by our Engineering experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
 

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.