public static void ReverseRotate(string[] a, int n, int r) { Array.Reverse(a, 0, n - r); Reverse.swap(a, n - r, n); //Array.Reverse(a, n-r, r); Array.Reverse(a, 0, n); }
static void Main(string[] args) { int[] a = { 1, 2, 3, 4, 5, 6 }; int n = a.Length; int k = 2; string [] b = { "a", "b", "c", "d", "e", "f", "g" }; int num = b.Length; int r = 2; // rotatearray(a, n, k); // GCD algorithm to rotate // rotatearrayBYK(a, n, k); //displayarray(a, n); // ReverseRotate(b, num, r); // Reverseal algorithm to rotate Reverse.Test(); }