diff --git a/Equivalent mutations/2D_to_1D.java b/Equivalent mutations/2D_to_1D.java new file mode 100644 index 0000000000000000000000000000000000000000..779a1dcd7a05a5276424e225f6aff2817fd8b069 --- /dev/null +++ b/Equivalent mutations/2D_to_1D.java @@ -0,0 +1,71 @@ +//http://www.sanfoundry.com/csharp-program-convert-2darray-1darray/ + + +class twodmatrix +{ + int m, n; + int[][] a; + int[] b; + twodmatrix(int x, int y) + { + this.m = x; + this.n = y; + this.a = new int[this.m][this.n]; + this.b = new int[this.m * this.n]; + } + public void readmatrix() + { + for (int i1 = 0; i1 < this.m; i1++) + { + for (int j1 = 0; j1 < this.n; j1++) + { + System.out.printf("a[{0},{1}]=", i1, j1); + this.a[i1][j1] = System.in.read(); + } + } + } + public void printd() + { + for (int i2 = 0; i2 < this.m; i2++) + { + for (int j2 = 0; j2 < this.n; j2++) + { + System.out.printf("{0}\t", this.a[i2][j2]); + + } + System.out.printf("\n"); + } + } + public void convert() + { + int k = 0; + for (int i3 = 0; i3 < this.m; i3++) + { + for (int j3 = 0; j3 < this.n; j3++) + { + this.b[k++] = this.a[i3][j3]; + } + } + } + public void printoned() + { + this.convert(); + + for (int i4 = 0; i4 < this.m * this.n; i4++) + { + System.out.printf("{0}\t", this.b[i4]); + } + } + + + public static void main(String[] args) + { + twodmatrix obj = new twodmatrix(2,3); + System.out.printf("Enter the Elements : "); + obj.readmatrix(); + System.out.printf("\t\t Given 2-D Array(Matrix) is : "); + obj.printd(); + System.out.printf("\t\t Converted 1-D Array is : "); + obj.printoned(); + } +} \ No newline at end of file diff --git a/Equivalent mutations/Mutants/2D_to_1D_no_1D.java b/Equivalent mutations/Mutants/2D_to_1D_no_1D.java new file mode 100644 index 0000000000000000000000000000000000000000..ec65976c8f7ea9ba096bb3cbcca618de0b5ab510 --- /dev/null +++ b/Equivalent mutations/Mutants/2D_to_1D_no_1D.java @@ -0,0 +1,60 @@ +//http://www.sanfoundry.com/csharp-program-convert-2darray-1darray/ + + +class twodmatrix +{ + int m, n; + int[][] a; + int[] b; + twodmatrix(int x, int y) + { + this.m = x; + this.n = y; + this.a = new int[this.m][this.n]; + } + public void readmatrix() + { + for (int i1 = 0; i1 < this.m; i1++) + { + for (int j1 = 0; j1 < this.n; j1++) + { + System.out.printf("a[{0},{1}]=", i1, j1); + this.a[i1][j1] = System.in.read(); + } + } + } + public void printd() + { + for (int i2 = 0; i2 < this.m; i2++) + { + for (int j2 = 0; j2 < this.n; j2++) + { + System.out.printf("{0}\t", this.a[i2][j2]); + + } + System.out.printf("\n"); + } + } + public void printoned() + { + for (int i4 = 0; i4 < this.m; i4++) + { + for (int j4 = 0; j4 < this.n; j4++) + { + Console.WriteLine("{0}\t", a[i*n+j]); + } + } + } + + + public static void main(String[] args) + { + twodmatrix obj = new twodmatrix(2,3); + System.out.printf("Enter the Elements : "); + obj.readmatrix(); + System.out.printf("\t\t Given 2-D Array(Matrix) is : "); + obj.printd(); + System.out.printf("\t\t Converted 1-D Array is : "); + obj.printoned(); + } +} \ No newline at end of file diff --git a/Equivalent mutations/Mutants/2D_to_1D_no_counter.java b/Equivalent mutations/Mutants/2D_to_1D_no_counter.java new file mode 100644 index 0000000000000000000000000000000000000000..ee1bf4b0220ee8835557dedca4f9bffe1822e95f --- /dev/null +++ b/Equivalent mutations/Mutants/2D_to_1D_no_counter.java @@ -0,0 +1,70 @@ +//http://www.sanfoundry.com/csharp-program-convert-2darray-1darray/ + + +class twodmatrix +{ + int m, n; + int[][] a; + int[] b; + twodmatrix(int x, int y) + { + this.m = x; + this.n = y; + this.a = new int[this.m][this.n]; + this.b = new int[this.m * this.n]; + } + public void readmatrix() + { + for (int i1 = 0; i1 < this.m; i1++) + { + for (int j1 = 0; j1 < this.n; j1++) + { + System.out.printf("a[{0},{1}]=", i1, j1); + this.a[i1][j1] = System.in.read(); + } + } + } + public void printd() + { + for (int i2 = 0; i2 < this.m; i2++) + { + for (int j2 = 0; j2 < this.n; j2++) + { + System.out.printf("{0}\t", this.a[i2][j2]); + + } + System.out.printf("\n"); + } + } + public void convert() + { + for (int i3 = 0; i3 < this.m; i3++) + { + for (int j3 = 0; j3 < this.n; j3++) + { + this.b[i*n+j] = this.a[i3][j3]; + } + } + } + public void printoned() + { + this.convert(); + + for (int i4 = 0; i4 < this.m * this.n; i4++) + { + System.out.printf("{0}\t", this.b[i4]); + } + } + + + public static void main(String[] args) + { + twodmatrix obj = new twodmatrix(2,3); + System.out.printf("Enter the Elements : "); + obj.readmatrix(); + System.out.printf("\t\t Given 2-D Array(Matrix) is : "); + obj.printd(); + System.out.printf("\t\t Converted 1-D Array is : "); + obj.printoned(); + } +} \ No newline at end of file diff --git a/Equivalent mutations/Mutants/Vectors01Generator_no_for.java b/Equivalent mutations/Mutants/Vectors01Generator_no_for.java new file mode 100644 index 0000000000000000000000000000000000000000..0e9ba54c7962a9ec0fffe060bf0c5226d0c08b76 --- /dev/null +++ b/Equivalent mutations/Mutants/Vectors01Generator_no_for.java @@ -0,0 +1,38 @@ +//http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-10-recursion/#demos-source-code + +class Vectors01Generator +{ + static void Gen01(int index, int[] vector1) + { + if (index == -1) + { + Print(vector1); + } + else + { + vector1[index] = 0; + Gen01(index - 1, vector1); + vector1[index] = 1; + Gen01(index - 1, vector1); + } + } + + static void Print(int[] vector2) + { + for (int i2 = 0; i2 < vector2.length; i2++) + { + System.out.printf("{0} ", i2); + } + System.out.println(); + } + + static void main() + { + System.out.print("n = "); + int number = System.in.read(); + + int[] vector3 = new int[number]; + + Gen01(number - 1, vector3); + } +} diff --git a/Equivalent mutations/Mutants/Vectors01Generator_print_string.java b/Equivalent mutations/Mutants/Vectors01Generator_print_string.java new file mode 100644 index 0000000000000000000000000000000000000000..99c44ec3a08b8b6a18df1746f27f17457650aa8b --- /dev/null +++ b/Equivalent mutations/Mutants/Vectors01Generator_print_string.java @@ -0,0 +1,40 @@ +//http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-10-recursion/#demos-source-code + +class Vectors01Generator +{ + static void Gen01(int index, int[] vector1) + { + if (index == -1) + { + Print(vector1); + } + else + { + for (int i1 = 0; i1 <= 1; i1++) + { + vector1[index] = i1; + Gen01(index - 1, vector1); + } + } + } + + static void Print(int[] vector2) + { + String str = ""; + for (int i2 = 0; i2 < vector2.length; i2++) + { + str = str + Integer.toString(i2) + " "; + } + System.out.println(str); + } + + static void main() + { + System.out.print("n = "); + int number = System.in.read(); + + int[] vector3 = new int[number]; + + Gen01(number - 1, vector3); + } +} diff --git a/Equivalent mutations/Vectors01Generator.java b/Equivalent mutations/Vectors01Generator.java new file mode 100644 index 0000000000000000000000000000000000000000..785438cf48fa8546478f3772d9a9c69776e8e4b3 --- /dev/null +++ b/Equivalent mutations/Vectors01Generator.java @@ -0,0 +1,39 @@ +//http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-10-recursion/#demos-source-code + +class Vectors01Generator +{ + static void Gen01(int index, int[] vector1) + { + if (index == -1) + { + Print(vector1); + } + else + { + for (int i1 = 0; i1 <= 1; i1++) + { + vector1[index] = i1; + Gen01(index - 1, vector1); + } + } + } + + static void Print(int[] vector2) + { + for (int i2 = 0; i2 < vector2.length; i2++) + { + System.out.printf("{0} ", i2); + } + System.out.println(); + } + + static void main() + { + System.out.print("n = "); + int number = System.in.read(); + + int[] vector3 = new int[number]; + + Gen01(number - 1, vector3); + } +} diff --git a/Equivalent mutations/original C# code/2D_to_1D_no_1D.cs b/Equivalent mutations/original C# code/2D_to_1D_no_1D.cs new file mode 100644 index 0000000000000000000000000000000000000000..cb1992c7411b12bb4443b3cf0cf26b4a403ff79d --- /dev/null +++ b/Equivalent mutations/original C# code/2D_to_1D_no_1D.cs @@ -0,0 +1,74 @@ +//http://www.sanfoundry.com/csharp-program-convert-2darray-1darray/ + +/* + * C# Program to Convert a 2D Array into 1D Array + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Program +{ + class twodmatrix + { + int m, n; + int[,] a; + twodmatrix(int x, int y) + { + m = x; + n = y; + a = new int[m, n]; + } + public void readmatrix() + { + for (int i = 0; i < m; i++) + { + for (int j = 0; j < n; j++) + { + Console.WriteLine("a[{0},{1}]=", i, j); + a[i, j] = Convert.ToInt32(Console.ReadLine()); + } + } + } + public void printd() + { + for (int i = 0; i < m; i++) + { + for (int j = 0; j < n; j++) + { + Console.Write("{0}\t", a[i, j]); + + } + Console.Write("\n"); + } + } + public void convert() + { + return; + } + public void printoned() + { + for (int i = 0; i < m; i++) + { + for (int j = 0; j < n; j++) + { + Console.WriteLine("{0}\t", a[i*n+j]); + } + } + } + + + public static void Main(string[] args) + { + twodmatrix obj = new twodmatrix(2,3); + Console.WriteLine("Enter the Elements : "); + obj.readmatrix(); + Console.WriteLine("\t\t Given 2-D Array(Matrix) is : "); + obj.printd(); + Console.WriteLine("\t\t Converted 1-D Array is : "); + obj.printoned(); + Console.ReadLine(); + } + } +} \ No newline at end of file diff --git a/Equivalent mutations/original C# code/2D_to_1D_no_counter.cs b/Equivalent mutations/original C# code/2D_to_1D_no_counter.cs new file mode 100644 index 0000000000000000000000000000000000000000..c69ec26e169527bcd84c55cfc37a5ac6afb59496 --- /dev/null +++ b/Equivalent mutations/original C# code/2D_to_1D_no_counter.cs @@ -0,0 +1,80 @@ +//http://www.sanfoundry.com/csharp-program-convert-2darray-1darray/ + +/* + * C# Program to Convert a 2D Array into 1D Array + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Program +{ + class twodmatrix + { + int m, n; + int[,] a; + int[] b; + twodmatrix(int x, int y) + { + m = x; + n = y; + a = new int[m, n]; + b = new int[m * n]; + } + public void readmatrix() + { + for (int i = 0; i < m; i++) + { + for (int j = 0; j < n; j++) + { + Console.WriteLine("a[{0},{1}]=", i, j); + a[i, j] = Convert.ToInt32(Console.ReadLine()); + } + } + } + public void printd() + { + for (int i = 0; i < m; i++) + { + for (int j = 0; j < n; j++) + { + Console.Write("{0}\t", a[i, j]); + + } + Console.Write("\n"); + } + } + public void convert() + { + for (int i = 0; i < m; i++) + { + for (int j = 0; j < n; j++) + { + b[i*n+j] = a[i, j]; + } + } + } + public void printoned() + { + for (int i = 0; i < m * n; i++) + { + Console.WriteLine("{0}\t", b[i]); + } + } + + + public static void Main(string[] args) + { + twodmatrix obj = new twodmatrix(2,3); + Console.WriteLine("Enter the Elements : "); + obj.readmatrix(); + Console.WriteLine("\t\t Given 2-D Array(Matrix) is : "); + obj.printd(); + obj.convert(); + Console.WriteLine("\t\t Converted 1-D Array is : "); + obj.printoned(); + Console.ReadLine(); + } + } +} \ No newline at end of file diff --git a/Equivalent mutations/original C# code/Vectors01Generator_no_for.cs b/Equivalent mutations/original C# code/Vectors01Generator_no_for.cs new file mode 100644 index 0000000000000000000000000000000000000000..4dc7f5cfa09183ca1ff97b0728283d6b17430a5f --- /dev/null +++ b/Equivalent mutations/original C# code/Vectors01Generator_no_for.cs @@ -0,0 +1,40 @@ +//http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-10-recursion/#demos-source-code + +using System; + +class Vectors01Generator +{ + static void Gen01(int index, int[] vector) + { + if (index == -1) + { + Print(vector); + } + else + { + vector[index] = 0; + Gen01(index - 1, vector); + vector[index] = 1; + Gen01(index - 1, vector); + } + } + + static void Print(int[] vector) + { + foreach (int i in vector) + { + Console.Write("{0} ", i); + } + Console.WriteLine(); + } + + static void Main() + { + Console.Write("n = "); + int number = int.Parse(Console.ReadLine()); + + int[] vector = new int[number]; + + Gen01(number - 1, vector); + } +} diff --git a/Equivalent mutations/original C# code/Vectors01Generator_print_string.cs b/Equivalent mutations/original C# code/Vectors01Generator_print_string.cs new file mode 100644 index 0000000000000000000000000000000000000000..98761c17098ded7a3e1da9aa9499ed234e21f3d3 --- /dev/null +++ b/Equivalent mutations/original C# code/Vectors01Generator_print_string.cs @@ -0,0 +1,42 @@ +//http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-10-recursion/#demos-source-code + +using System; + +class Vectors01Generator +{ + static void Gen01(int index, int[] vector) + { + if (index == -1) + { + Print(vector); + } + else + { + for (int i = 0; i <= 1; i++) + { + vector[index] = i; + Gen01(index - 1, vector); + } + } + } + + static void Print(int[] vector) + { + String str = ""; + foreach (int i in vector) + { + str = str + i.ToString() + " "; + } + Console.WriteLine(str); + } + + static void Main() + { + Console.Write("n = "); + int number = int.Parse(Console.ReadLine()); + + int[] vector = new int[number]; + + Gen01(number - 1, vector); + } +}