Skip to main content
Module

x/statistics/mod.ts>modeSorted

Deno basic statistics module.
Latest
function modeSorted
Re-export
import { modeSorted } from "https://deno.land/x/statistics@v0.1.1/mod.ts";

The mode is the number that appears in a list the highest number of times. There can be multiple modes in a list: in the event of a tie, this algorithm will return the most recently seen mode.

This is a measure of central tendency: a method of finding a typical or central value of a set of numbers.

This runs in O(n) because the input is sorted.

Examples

modeSorted([0, 0, 1]); // => 0

Parameters

sorted: number[]

a sample of one or more data points

Returns

number

mode