I was converting a C++ algorithm to C#. I came across this for loop:
for (u = b.size(), v = b.back(); u--; v = p[v])
b[u] = v;
It gives no
This will be the C# form of your loop.
// back fetches the last element of vector in c++.
for (u = b.size(), v = b.back(); (u--) != 0; v = p[v])
{
b[u] = v;
}
Just replace equivalent for size() and back().
What it does is reverses the list and stores in an array. But in C# we directly have system defined function for this. So you don't need to write this loop also.
b = b.Reverse().ToArray();