Question 1 Which sorting algorithm is implemented here? Question 2 What is the time complexity of this sort in the worst case? Question 3 Have a look at the array below. We are trying to do quicksort...



Question 1 Which sorting algorithm is implemented here?



Question 2What is the time complexity of this sort in the worst case?



Question 3Have a look at the array below. We are trying to do quicksort on this array to sort it in ascending order. We wrote an algorithm that always takes the middle element as pivot. How the array will look like after first iteration(write in this format: 11,12,13,14,15)Array: 812 734 689 155 667 368 964 831 167 .


You are given a code below:<br>def Sort(arr):<br>if length(arr) > 1:<br>a = length(arr)//2<br>1 = arr[:a]<br>r - arr[a:]<br>Sort(1)<br>Sort(r)<br>b = c = d = 0<br>while b < length(1) and c < length(r):<br>if 1[b] < r[c]:<br>arr[d] = 1[b]<br>b += 1<br>else:<br>arr[d] = r[c]<br>C += 1<br>d += 1<br>while b < length(1):<br>arr[d] = 1[b]<br>b += 1<br>d += 1<br>while c < length(r):<br>arr[d] = r[c]<br>C += 1<br>d += 1<br>def printList(arr):<br>for i in range(length(arr)):<br>print(arr[i], end=

Extracted text: You are given a code below: def Sort(arr): if length(arr) > 1: a = length(arr)//2 1 = arr[:a] r - arr[a:] Sort(1) Sort(r) b = c = d = 0 while b < length(1)="" and="" c="">< length(r):="" if="" 1[b]="">< r[c]:="" arr[d]="1[b]" b="" +="1" else:="" arr[d]="r[c]" c="" +="1" d="" +="1" while="" b="">< length(1):="" arr[d]="1[b]" b="" +="1" d="" +="1" while="" c="">< length(r):="" arr[d]="r[c]" c="" +="1" d="" +="1" def="" printlist(arr):="" for="" i="" in="" range(length(arr)):="" print(arr[i],="" end=" " )="">

Jun 02, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here