human
Give me a code to recursive Selection Sort and the other steps required given the following:
Recursive Selection Sort | Return minimum index.
Find minimum of remaining elements.
Return minimum of current and remaining ..
Recursive selection sort . n is size of a [ ] and index is index of starting element ..
Return when starting and size are same.
calling minimum index function for minimum index.
Swapping when index and minimum index are not same.
swap.
Recursively calling selection sort function.
Driver code.
Calling function.
printing sorted array"
Solution in Python:
assistant
#Here is code to recursive Selection Sort and the other steps required.
 def minIndex ( a , i , j ) :
	if i == j :
		return i
	k = minIndex ( a , i + 1 , j )
	return ( i if a [ i ] < a [ k ] else k )
def recurSelectionSort ( a , n , index = 0 ) :
	if index == n :
		return - 1
	k = minIndex ( a , index , n - 1 )
	if k != index :
		a [ k ] , a [ index ] = a [ index ] , a [ k ]
			a [ k ] , a [ index ] = a [ index ] , a [ k ]
	recurSelectionSort ( a , n , index + 1 )
arr = [ 3 , 1 , 5 , 2 , 7 , 0 ]
n = len ( arr )
recurSelectionSort ( arr , n )
for i in arr :
	print ( i , end = ' ▁ ' )