Skip to main content
Module

x/structurae/sorted-array.ts>SortedArray.getIntersectionScore

Data structures for high-performance JavaScript applications.
Latest
method SortedArray.getIntersectionScore
import { SortedArray } from "https://deno.land/x/structurae@4.0.1/sorted-array.ts";

Returns the amount of common elements in two sorted arrays.

Examples

SortedArray.getIntersection([1, 2, 3, 4, 8], [2, 4, 6, 7, 9]); //=> 2

Parameters

a: U

the first array

b: U

the second array

optional
comparator: Comparator<T> = [UNSUPPORTED]

Returns

number

the amount of different elements