0
$\begingroup$

I have a simple question. I have a vector that has only 0/1 values. I want to count the number of sequences that are larger than some number. For example, find out how many times I have a run of three ones (1,1,1) or more.

Any smart idea how to do that?

Thank you, Nitzan.

$\endgroup$
0
$\begingroup$

First of all, this isn't clustering: no statistical analysis involved.

Second, the obvious algorithm is already O(n) and I don't think you want to look into approximation or SIMD optimization.

Just process one item at a time: does it continue the current run, or start a new run.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.