"Sputnik" help |

Sputnik
Help

Description

Determines the similarity between two binary strings and outputs the similarity count and percentage.Parameters

<binary2> | The first binary string for comparison. |

<binary3> | The second binary string for comparison. |

[<percent>] | (Optional) The variable where the similarity percentage will be stored. |

Return Value

Success: | Returns the similarity count between the two binary strings. |

Failure: | Returns 0. |

Remarks

The **BinarySimilar** function compares two binary strings and
calculates their similarity count and percentage. It outputs the similarity
percentage to the specified variable.

**Algorithm Complexity**

The algorithm employed by **BinarySimilar** has a complexity of
O(N**3), where N is the length of the longer of the two binary strings. It calculates
similarity by exploring common substrings, and despite the recursive approach,
it offers an effective method for comparing strings. Users should be mindful
of the potential computational cost, especially for longer binary strings.

Related

Example

Example of usage:

my$result=BinarySimilar(Bin("CAT"),Bin("CAT"),$percent);say"Result: $result ($percent%)";my$result=BinarySimilar(Bin("CAT"),Bin("CAt"),$percent);say"Result: $result ($percent%)";my$result=BinarySimilar(Bin("CAT"),Bin("Cat"),$percent);say"Result: $result ($percent%)";my$result=BinarySimilar(Bin("CAT"),Bin("cat"),$percent);say"Result: $result ($percent%)";// PRINTS// Result: (100%)// Result: (66.6666666666667%)// Result: (33.3333333333333%)// Result: (0%)

Contact

Cheryl (uberfox@hotmail.com)

Homepage

http://ubersoft.org