Is there a class (function, method etc or any feature) like below feature?
example of conception)
A class that making all case combination.
NSString *sourceString = [[NSString alloc] initWithString:@"ABC"];
NSArray *sourceArray = [[NSArray alloc] initWithObjects:@"A", @"B", @"C"];
someClass *someClass1 = [[someClass alloc] init];
NSString *caseResultAsString = [someClass1 makeAllCaseCombinationToStr:sourceString pair:2];
NSArray *caseResultAsArray = [someClass1 makeAllCaseCombinationToArray:sourceArray pair:2];
value of caseResultAsString is
“AA AB AC BA BB BC CA CB CC” (pair argument is 2)
value of caseResultAsArray is
{“AA”,
“AB”,
“AC”,
“BA”,
“BB”,
“BC”,
“CA”,
“CB”,
“CC”}
If input source and output result is any type or any way, it doesn’t matter.
I want to know if there is a class with feature of above conception.
Here’s a very simple
NSSetcategory:Obviously, the algorithm’s time is
O((N^T) + O(N)), whereNis the elements in the set andTis the number of objects per permeation. This could easily be changed to have a NSSet of NSArrays if you wanted, but This currently just uses a string.