Question
Consider the following Python-like pseudo-code for a
modified Merge Sort algorithm that sorts an array `arr` and also counts the number of "reverse pairs" (i.e., pairs `(i, j)` such that `i < j` and `arr[i] > 2 arr[j]`). ```python def merge_sort_and_count_reverse_pairs(arr): n = len(arr) if n 2 right_half[j]: cross_pairs += (len(left_half) - i) # All remaining elements in left_half form a reverse pair with right_half[j] j += 1 else: i += 1 # Standard merge step (omitted for brevity, assume it correctly merges left_half and right_half) merged_arr = merge(left_half, right_half) return merged_arr, left_pairs + right_pairs + cross_pairs # Assume a standard merge function exists: # def merge(left, right): # ... returns sorted merged array ... input_array = [2, 4, 3, 5, 1] ``` If `merge_sort_and_count_reverse_pairs(input_array)` is called, what will be the total number of reverse pairs returned?Solution
The pairs are: (2,1), (4,1), (3,1), (5,1).
Find the value of ‘x’ in the given expression
(49/16)x × (64/343)x-1 = 4/7
If a3 — b3 = 602 and a— b = 2, then find the value of( a2 + b2)
If (x 2 = 6x – 9), then find the value of [x³ + (x⁴/9)][5 - x³]
- If (x - y) = 5, then find the value of (x³ - y³ - 15xy).
If √b + (1/√b) = 11, then find the value of b + (1/b).
If (r + s + t) = 12 and (rs + st + tr) = 60, then find the value of (r² + s² + t²).
If, ( a + b = 14 ) and ( a² + b² = 106 ), then find the value of (a³ + b³).
If (a + b) = 13 and ab = 18, find the value of (a² + b²).
If a – b – c = 0, then the value of (a2 + b2 + c2)/(b + ac) is: