Category: maths-mean

Check if given array can be rearranged such that mean is equal to median

#include using namespace std;bool binarySearch(float arr[], int size, float key){    int low = 0, high = size – 1, mid;    while (low arr[mid])            low = mid + 1;                        else if (key < arr[mid])            high = mid - 1;                        else            return 1;    }            return 0;}bool twoPointers(float arr[], int N, float mean){    int i = 0, j = N - 1;    while (i < j) {                float temp = […]

Continue Reading

Calculate Median from given values of Mean and Mode

Given two integers mean and mode, representing the Mean and Mode of a random group of data, the task is to calculate the median of that group of data.Input: mean = 3, mode = 6Output: 4Input: mean = 1, mode = 1Output : 1Approach: The given problem can be solved by using the mathematical relationship […]

Continue Reading