Characteristic and Frequency Vectors



We consider the following problem: Given two sequences of decimal digits. Determine the common digits in ascending order.


Depending on the number of digits in the two sequences, we can implement various solutions:



Characteristic Vector

None of the above solutions take into account a key property of the values in the sequence – that they are digits, i.e., between 0 and 9. We can proceed as follows:


The two vectors v[] and u[] are characteristic vectors. Their elements characterize the digits between 0 and 9, indicating for each digit whether it is part of the corresponding sequence or not. Note that we do not need to store the elements of the two given sequences. We are only interested in the distinct values that appear in each sequence, regardless of their order.



Example:




When to Use the Characteristic Vector?

To use a characteristic vector, at least the following conditions must be met:



Frequency Vector

Let's consider again a sequence of decimal digits. Determine the digit that appears most frequently. If there are multiple digits that appear the maximum number of times, determine the smallest (or largest, or all, etc.).



Example:



Accessibility Options

Color Contrast

Text Size

Text Spacing

Reading Aids