If ar is an array, which element will be referenced using ar(7)
Answers
Answered by
5
Answer:
Eighth element
hope this will helps you :-D
Answered by
1
Answer:
def partition(array, low, high):
pivot = array[high]
i = low - 1
for j in range(low, high):
if array[j] <= pivot:
i = i + 1
(array[i], array[j]) = (array[j], array[i])
(array[i + 1], array[high]) = (array[high], array[i + 1])
return i + 1
def quickSort(array, low, high):
if low < high
pi = partition(array, low, high)
quickSort(array, low, pi - 1)
quickSort(array, pi + 1, high)
data = [8, 7, 2, 1, 0, 9, 6]
print("Unsorted Array")
print(data)
size = len(data)
quickSort(data, 0, size - 1)
print('Sorted Array in Ascending Order:')
print(data)
#SPJ2
Similar questions
Accountancy,
3 months ago
Music,
3 months ago
Hindi,
7 months ago
Science,
11 months ago
Hindi,
11 months ago