New answers tagged

1

Change your API so that the user must provide a buffer of type (f32, isize) (or a wrapper type thereof) so that you can store the indices associated with each sample in your window. Then you can turn this buffer into a double-ended queue by having two indices, head and tail, and forming a ring buffer. Then you can apply the algorithm I described here to get ...


0

Change the API. All reasonable data structures require more space. There is no solution that I am aware of within your constraints. Your current API imposes a limitation on the set of data structures you can use that is too strict to admit a good solution. Fortunately, this is solvable, as long as you are willing to change the API. You just need to push ...


Top 50 recent answers are included