import { modeFast } from "https://deno.land/x/simplestatistics@v7.7.5/index.js";
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.
modeFast uses a Map object to keep track of the mode, instead of the approach
used with mode
, a sorted array. As a result, it is faster
than mode
and supports any data type that can be compared with ==
.
It also requires a
JavaScript environment with support for Map,
and will throw an error if Map is not available.
This is a measure of central tendency: a method of finding a typical or central value of a set of numbers.