private void RunTwo(MaxXor maxXor) { Console.WriteLine("Elements of Two ====================="); int[] values; int max; values = new int[] { 3, 10, 5, 25, 2, 8 }; max = maxXor.FindTwo(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max}"); values = new int[] { 3, 10, 5, 25 }; max = maxXor.FindTwo(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max}"); values = new int[] { 3, 10, 5 + 16, 25 }; max = maxXor.FindTwo(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max}"); values = new int[] { 16 + 3, 16 + 10, 16 + 5, 25 }; max = maxXor.FindTwo(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max}"); values = new int[] { 10, 2, 8 }; max = maxXor.FindTwo(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max}"); }
public void Run() { Console.WriteLine("Xor ====================="); MaxXor maxXor = new MaxXor(); // RunTwo(maxXor); RunAnyOfSubset(maxXor); }
private void RunAnyOfSubset(MaxXor maxXor) { Console.WriteLine("Elements of Subset ====================="); int[] values; int max, maxWithGau; values = new int[] { 1, 2, 3, 4 }; max = maxXor.FindAnyOfSubset(values); maxWithGau = maxXor.FindAnyOfSubsetWithGaussian(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max} and {maxWithGau}(Gaussian)"); values = new int[] { 8, 1, 2, 12, 7, 6 }; max = maxXor.FindAnyOfSubset(values); maxWithGau = maxXor.FindAnyOfSubsetWithGaussian(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max} and {maxWithGau}(Gaussian)"); values = new int[] { 4, 6 }; max = maxXor.FindAnyOfSubset(values); maxWithGau = maxXor.FindAnyOfSubsetWithGaussian(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max} and {maxWithGau}(Gaussian)"); values = new int[] { 9, 7, 4, 3 }; max = maxXor.FindAnyOfSubset(values); maxWithGau = maxXor.FindAnyOfSubsetWithGaussian(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max} and {maxWithGau}(Gaussian)"); values = new int[] { 2, 11, 6, 14, 10 }; max = maxXor.FindAnyOfSubset(values); maxWithGau = maxXor.FindAnyOfSubsetWithGaussian(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max} and {maxWithGau}(Gaussian)"); values = TrieCommon.GetNums(5); max = maxXor.FindAnyOfSubset(values); maxWithGau = maxXor.FindAnyOfSubsetWithGaussian(values); Console.WriteLine($"The max xor of {string.Join(",", values)} is {max} and {maxWithGau}(Gaussian)"); }