Consider the following Python function:1
def fun(D, s1, s2):
if s1 < s2:
D[s1], D[s2] = D[s2], D[s1]
fun(D, s1+1, s2-
What does this Python function fun() do? Select the ONE appropriate option below.
It finds the smallest element in D from index s1 to s2, both inclusive.
It performs a merge sort in-place on this list D between indices s1 and s2, both inclusive.
It reverses the list D between indices s1 and s2, both inclusive
It swaps the elements in D at indices s1 and s2, and leaves the remaining elements unchanged.
This question is part of this quiz :
GATE DA 2024,GATE DA Programming, Data structure and Algorithms Quiz