Fri, 22 Aug 2008 09:22:00 GMT

Permutation class

Permutations! I’ve hit this issue quite a number of times in my life: at university, at work. It’s not unusual to encounter problems where it’s very handy to able to iterate all possible permutations of something. And catch is: standard libraries sometimes do not offer any help. The engineer is left to tackle the problem by him- or herself.


Thu, 21 Aug 2008 11:04:00 GMT

Factorial function in Objective-C

Factorial, denoted by n! and defined as the product of all positive integers less than or equal to n.


Wed, 20 Aug 2008 08:03:00 GMT

Sorting an array by another array

Suppose you want to sort an array of strings according to some prescribed order. In other words, you are given an array of strings as input, plus another array of strings describing the required ordering. The result is another array of strings equal to the first but sorted by the second.