Question: Write a Python function MoM7Pos(arr) that accepts a list arr of integers( not necessarily distinct) and computes the median of medians(of blocks) M dividing

Write a Python function MoM7Pos(arr) that accepts a list arr of integers( not necessarily distinct) and computes the median of medians(of blocks) M dividing the list arr into blocks of 7 and returns the position of M in arr if it were sorted. If M is repeated more than once in the list arr return the index of first occurrence of M in arr if it were sorted. For simplicity the size of arr will be a multiple of 7. Your solution should run in O(n) time. Sample Input 44 9 31 12 15 98 48 45 13 75 23 6 35 74 Sample Output 1 7 ses Assignment
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
