frequency
: The default frequency value. It is optional and has a default
value of 0.
Optional
frequency?: numberThe above function returns the value of the protected variable _freq
.
The frequency value stored in the protected variable _freq
.
The function returns the frequency map of numbers.
The _freqMap
property, which is a record with number keys and number values, is being
returned.
The above function returns the maximum value.
The maximum value stored in the variable _max
.
The function returns the value of the _msb property.
The _msb
property of the object.
The function returns the value of the _negativeCount property.
The method is returning the value of the variable _negativeCount
, which is of type
number
.
Protected
_binaryThe function _binarySearch
performs a binary search to find the largest number that satisfies a given
condition.
The sum parameter is a number that represents the target sum value.
The before
parameter is a function that takes two numbers x
and y
as
arguments and returns a boolean value. It is used to determine if x
is less than or equal to
y
. The purpose of this function is to compare two numbers and determine their order.
the value of the variable "left".
Protected
_checkProtected
_getProtected
_readThe _read
function calculates the sum of values in a binary freqMap up to a given count.
The count
parameter is a number that represents the number of elements
to read from the freqMap.
the sum of the values obtained from calling the _getFrequency
method for each index in the
range from count
to 1.
Protected
_readProtected
_updateThe _update
function updates the values in a binary indexed freqMap starting from a given index and
propagating the changes to its parent nodes.
The index
parameter is a number that represents the index of the element in
the data structure that needs to be updated.
The delta
parameter represents the change in value that needs to be
applied to the elements in the data structure.
Protected
_updateThe function _updateFrequency adds a delta value to the element at the specified index in the freqMap array.
The index parameter is a number that represents the index of the freqMap element that needs to be updated.
The delta
parameter represents the change in value that needs to be
added to the freqMap at the specified index
.
Protected
_updateProtected
_writeThe _writeSingle
function updates the frequency at a specific index and triggers a callback if
the frequency has changed.
The index
parameter is a number that represents the index of the element
being modified or accessed.
The freq
parameter represents the new frequency value that needs to be
written to the specified index index
.
The function calculates the prefix sum of an array using a binary indexed tree.
The parameter "i" in the function "getPrefixSum" represents the index of the element in the array for which we want to calculate the prefix sum.
The function getPrefixSum
returns the prefix sum of the elements in the binary indexed tree up to index
i
.
The function returns the lower bound of a non-descending sequence that sums up to a given number.
The sum
parameter is a number that represents the target sum that we want
to find in the sequence.
The lowerBound function is returning a number.
The read function takes a count parameter, checks if it is an integer, and returns the result of calling the _read function with the count parameter clamped between 0 and the maximum value.
The count
parameter is a number that represents the number of items to
read.
a number.
The "update" function updates the value at a given index by adding a delta and triggers a callback to notify of the change.
The index
parameter represents the index of the element that needs to be
updated in the data structure.
The "delta" parameter represents the change in value that needs to be applied to the frequency at the specified index.
The upperBound function returns the index of the first element in a sequence that is greater than or equal to a given sum.
The "sum" parameter is a number that represents the target sum that we want to find in the sequence.
The upperBound function is returning a number.
The function "writeSingle" checks the index and writes a single value with a given frequency.
The index
parameter is a number that represents the index of an element. It
is used to identify the specific element that needs to be written.
The freq
parameter represents the frequency value that needs to be
written.
The constructor initializes the properties of an object, including default frequency, maximum value, a freqMap data structure, the most significant bit, and the count of negative frequencies.