Question: 3. Ocean Wave Given a 2D array which is unsorted both row-wise and column wise. Sort each column into a wave like structure. An array

![An array arr[e..n-1] is sorted in wave form if arr[] >= arr[1]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4510d538c2_56466f4510ce682f.jpg)
3. Ocean Wave Given a 2D array which is unsorted both row-wise and column wise. Sort each column into a wave like structure. An array arr[e..n-1] is sorted in wave form if arr[] >= arr[1] = arr[3] = But note that you have to wave-sort the columns. You should assume that the input provided will always produce a wave. Input : [[20, 2, 3] [10, 4, 6] [8, 6, 5]. [6, 8, 10] [4, 1e, 71. [2, 38, 40]] [10, 4, 6), [8, 6, 5] [6, 8, 10]. [4, 10, 7] [2, 30, 40]] I Output : [[20, 4, 6] [8, 2, 3] [10, 8, 10] [4, 6, 5), [6, 30, 40, [2, 10, 7]] Return the sorted 2d array output # TODO : complete the function as required # return 2d array after sorting as required. def ocean_wave (nums): return nums if __name__ =="__main__": print("Your personal test cases go below here!')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
