Created
November 9, 2013 14:01
-
-
Save andijcr/7385710 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mele = ['annurca', 'fuji','cox', 'golden','renetta', 'granny smith', 'elstar', 'pink lady'] | |
partitions = function (set, n){ | |
var albero={} | |
if(n>0){ | |
for(var i=0; i< set.length; i++){ | |
var tset=set.slice() | |
var key=tset.splice(i,1)[0]; | |
albero[key]=partitions(tset, n-1) | |
} | |
} | |
return albero | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment