Manoj Talreja Manoj Talreja - 12 days ago 10
C# Question

Array.Reverse algorithm?

What kind of algorithm Array.Reverse(string a), uses behind the scene to reverse the string?

Answer

Probably a standard in-place reversal algorithm.

function reverse-in-place(a[0..n])
 for i from 0 to floor(n/2)
     swap(a[i], a[n-i])

Sources