public void GetPermutation() { BackTrackingQ back = new BackTrackingQ(); string res = back.GetPermutation(4, 13); Assert.That(back.GetPermutation(2, 2) == "21"); }
public void GeneratePermutation() { BackTrackingQ back = new BackTrackingQ(); var res = back.GeneratePermutation(3); Assert.That(res.Count == 6); res = back.GeneratePermutation(4); Assert.That(res.Count == 24); }
public static void Permute() { List <int> list = new List <int>() { 1, 2, 3 }; Assert.That(BackTrackingQ.Permute(list).Count == 6); Assert.That(BackTrackingQ.Permute2(list).Count == 6); }
public static void Subset() { BackTrackingQ track = new BackTrackingQ(); List <int> list = new List <int>(); list.Add(1); list.Add(2); list.Add(3); var result = track.Subsets(list); string set = "abc"; List <string> results = track.GetSubsets(set); Assert.That(results.Count == 8); }
public void FullJustify() { BackTrackingQ back = new BackTrackingQ(); List <string> words = new List <string>() { "This", "is", "an", "example", "of", "text", "justification." }; List <string> lines = back.FullJustify(words, 16); Assert.That(lines.Count == 3); words = new List <string>() { "What", "must", "be", "shall", "be." }; lines = back.FullJustify(words, 12); Assert.That(lines.Count == 2); }
public static void LetterCombinations() { BackTrackingQ back = new BackTrackingQ(); var combines = back.LetterCombinations("23"); }
public void PartitionPalindrome() { BackTrackingQ back = new BackTrackingQ(); var res = back.PartitionPalindrome("cccaa"); }
public void Combine() { BackTrackingQ track = new BackTrackingQ(); track.Combine(3, 2); }