1

friends and sirs...

If I have an NSArray of NSNumbers like this: 1, 2, 3

Then the set of all possible permutations would look something like this:

1
2
3
1 , 2
1 , 3
2 , 3
2 , 1
3 , 1
3 , 2
1 , 2 , 3
1 , 3 , 2
2 , 1 , 3
...

What's a good way to do this in XCode?

Please help me...

thanks.

Sam DeHaan
  • 10,246
  • 2
  • 40
  • 48
  • I tried followings. http://stackoverflow.com/questions/6617253/permutations-anagrams-in-objective-c-i-am-missing-something but no luck.... – Smile Winner Apr 03 '12 at 14:26
  • Mathematically speaking, your example is not the permutations. A permutation is an organization of a set of objects in a particular order. To get a permutation of 1, 2, and 3, you need to use the objects 1, 2, and 3. 1 by itself is not a permutation of that set. 1 is a subset of the set. – jmstone617 Apr 03 '12 at 15:17
  • Looks like a school assignment, that you haven't even given a shot at. – Guillaume Apr 03 '12 at 15:29

0 Answers0