This is what I would like to do.
I have huge number of number in a list, but it has a sequence of either increasing or decreasing.
Such as, 100 200 300 400 500 600 500 400 300 200 100 500 700 800 900
Lets say this values are stored in a list or maybe an array. How could I separate these to multiple arrays or list consisting of the sequence.
Such as, List 1: 100 200 300 400 500 600 List 2 :500 400 300 200 100 List 3:500 700 800 900
This is what I have done. I am stuck.
for (int i = 0; i < p.Count - 1; i++)
{
double v = p.ElementAt(i);
if (initialP > v)
{
if (low == 1)
{
sep.Add(sep_index);
low = 0;
}
else
{
}
high = 1;
}
if (initialP < v)
{
if (high == 1)
{
sep.Add(sep_index);
high = 0;
}
low = 1;
}
initialP = v;
sep_index++;
if (i == p.Count - 2)
{
sep.Add(sep_index);
}
}