java - good way to seperate List<Integer> into 5 lists of chunks around the 5 minimums -
ok guys, time creative. have list of integers, , want preserve integers in 5 green boxes below. thought finding 5 minimums, , going left , right each 1 until next integer distance far. may difficult last boxes have scattered values maintain.
so cliff notes, have list of integers want make 5 lists of integers from, each 1 of 5 lists holding values of 1 of green boxes.
i sorry if question seems dumb, wanting see if other people had better ways of going 1 mentioned above.
edit: perhaps levenberg-marquardt algorithm help? if understand math books xd. swear math explanations never written in english, if shows me use, , how to, , understand it. can go read out of book again , confused on again!
that possible solution:
let call list of integer p[n].
- define new list of point, call max[n], calculated way:
if ((max[n] < p[n]) || (n == 0)) max[n] = p[n]; else max[n] = max[n-1];
in way, max[n] list green line above graph:
first solution: identify points inside green boxes, have calculate incremental ratio of p list, , check when absolute value smaller threshold:
i = [p[n+1] - p[n]] / [t[n+1] - t[n]]
so point green box if below threshold , p below max:
if ((p[n] < max[n]) && (abs(i) < der_threshold)) // point inside green box
from graph, roughtly, put der_threshold = 5.
second solution: calculate new list of integers, called time avg[n] that:
avg[n] = (max[n] + p[n]) / 2
this end in red line (sorry ugly graph, did hand):
and can identify green boxes checking if p[n] below avg[n].
this solution better using kind of low filtering in avg calculation.
Comments
Post a Comment