Tag Archives: statistical-algorithms

Minimum number of elements to add to make median equals xNovember 5, 2017

A median in an array with the length of n is an element which occupies position number (n+1)/2 after we sort the elements in the… Read More »

Program to find correlation coefficientOctober 31, 2017

Given two array elements and we have to find the correlation coefficient between two array. Correlation coefficient is an equation that is used to determine… Read More »

Program for weighted mean of natural numbers.

There are given an array of natural numbers and another array with corresponding weight of the number. Then we have to calculate the weighted mean.… Read More »

Program for harmonic mean of numbersOctober 28, 2017

Given an array of elements, find harmonic mean of numbers. Examples: Input : arr[] = {2.0, 1.0} Output : 1.3333 Harmonic mean = 2/(1/2.0 +… Read More »

Bessel’s InterpolationOctober 24, 2017

Interpolation is the technique of estimating the value of a function for any intermediate value of the independent variable, while the process of computing the… Read More »

Median after K additional integersOctober 23, 2017

Given an array of n integers. We are allowed to add k additional integer in the array and then find the median of the resultant… Read More »

Program for Variance and Standard Deviation of an arrayOctober 21, 2017

Given an array, we need to calculate the variance and standard deviation of the elements of the array. Examples: Input : arr[] = [1, 2,… Read More »

Interquartile Range (IQR)October 20, 2017

The quartiles of a ranked set of data values are three points which divide the data into exactly four equal parts, each part comprising of… Read More »

Secretary Problem (A Optimal Stopping Problem)

The Secretary Problem also known as marriage problem, the sultan’s dowry problem, and the best choice problem is an example of Optimal Stopping Problem. This… Read More »

Mean and Median of a matrixOctober 18, 2017

Given a sorted matrix of size n*n. Calculate the mean and median of the matrix . Examples: Input : 1 2 3 4 5 6… Read More »

Program for Mean and median of an unsorted arrayOctober 17, 2017

Given n size unsorted array, find its mean and median. Mean of an array = (sum of all elements) / (number of elements) Median of… Read More »

Find median in row wise sorted matrixJuly 15, 2017

We are given a row wise sorted matrix of size r*c, we need to find the median of the matrix given. It is assumed that… Read More »

Median of Stream of Running Integers using STLJuly 14, 2017

Given that integers are being read from a data stream. Find median of all the elements read so far starting from the first integer till… Read More »

Find median of BST in O(n) time and O(1) spaceJune 16, 2017

Given a Binary Search Tree, find median of it. If no. of nodes are even: then median = ((n/2th node + (n+1)/2th node) /2 If… Read More »

Statistical Functions in Python | Set 1 (Averages and Measure of Central Location)August 22, 2016

Python has the ability to manipulate some statistical data and calculate results of various statistical operations using the file “statistics“, useful in domain of mathematics.… Read More »