Help on algorythm

  • Thread starter Helder Oliveira
  • Start date
H

Helder Oliveira

Guys i have been trying to make this algorythm but with no sucess, can
you help me out ?

The problem is the follow

for the following numberset like 1,2,3,4,5,6,7,8,9,10,11,12 i need to
take all the five number combinations, six number combinations and the
seven number combinations, this cant be "hardcoded", this need to be
flexible because at any time i may need all the 3 number combinations
and later i may need numbersets of 15 or even more.

Need a little help with this guys :)


Note: this is not for a school work or project :)
 
G

Glen Holcomb

[Note: parts of this message were removed to make it a legal post.]

Guys i have been trying to make this algorythm but with no sucess, can
you help me out ?

The problem is the follow

for the following numberset like 1,2,3,4,5,6,7,8,9,10,11,12 i need to
take all the five number combinations, six number combinations and the
seven number combinations, this cant be "hardcoded", this need to be
flexible because at any time i may need all the 3 number combinations
and later i may need numbersets of 15 or even more.

Need a little help with this guys :)


Note: this is not for a school work or project :)
http://www.google.com/search?hl=en&q=Ruby+permutations&btnG=Google+Search&aq=f&oq=
 
C

Chris Lowis

Gregory said:
Oh come on, we can do better than that:
http://tinyurl.com/57769d

Of course, this assumes that one knows the meaning of the English word
Permutations. I'm not sure if this was the case or not with the original
poster, perhaps he wasn't simply being lazy :) !

Chris
 
R

Robert Dober

Of course, this assumes that one knows the meaning of the English word
Permutations. I'm not sure if this was the case or not with the original
poster, perhaps he wasn't simply being lazy :) !
Oh he did not ask for permutations, he asked for combinations, are we
being unfriendly?
R.

--=20
Il computer non =E8 una macchina intelligente che aiuta le persone
stupide, anzi, =E8 una macchina stupida che funziona solo nelle mani
delle persone intelligenti.
Computers are not smart to help stupid people, rather they are stupid
and will work only if taken care of by smart people.

Umberto Eco
 
G

Glen Holcomb

[Note: parts of this message were removed to make it a legal post.]

Oh he did not ask for permutations, he asked for combinations, are we
being unfriendly?
R.
Good point he didn't specifically state that position mattered and did
actually say combination, oh well my bad ;)
 
C

Chris Lowis

Oh he did not ask for permutations, he asked for combinations, are we
being unfriendly?

No, not at all. I was simply making the observation that selecting the
correct (often English due to the availability of material in that
language) word can open a goldmine of results in Google searches.
Sometimes all one can do is explain a concept, because one doesn't have
the vocabulary to reduce it to a single, searchable word.

At least, that's been my experience with the non-native languages I
speak poorly, and I'm counting mathematics as one of those languages
here!

Chris
 
K

Ken Bloom

Guys i have been trying to make this algorythm but with no sucess, can
you help me out ?

The problem is the follow

for the following numberset like 1,2,3,4,5,6,7,8,9,10,11,12 i need to
take all the five number combinations, six number combinations and the
seven number combinations, this cant be "hardcoded", this need to be
flexible because at any time i may need all the 3 number combinations
and later i may need numbersets of 15 or even more.

Need a little help with this guys :)


Note: this is not for a school work or project :)

In Ruby 1.8.7

numberset=(1..12).to_a

(5..7).each do |combination_size|
numberset.combination(combination_size).do_something_with_it
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,184
Messages
2,570,978
Members
47,561
Latest member
gjsign

Latest Threads

Top