Binomial coefficient

M

mail

Hi

I'm very sorry for maybe posting something which was already posted.

--> How can I compute the binomial coefficient in C++? <--

Is it possible that there is no existing library for that out there
(expect something that big like the gnu scientific library)?

I searched the groups but couldn't find some good answers to this
question except something like "Hey you - why are you posting that? We
already answered this stuff." but without some _usefull_ links.

Of course I can write something on my one - which I actually did - but
then I have to handle with problems like type-overflow and the
largeness of some factorials (which I can actually compute till 12
with datatype long - not big at all).

So if someone out there knows a good solution for this - I would be
very appreciative.

Thanks a lot
- Egg
 
V

Victor Bazarov

I'm very sorry for maybe posting something which was already posted.

--> How can I compute the binomial coefficient in C++? <--

You write a program that does that. You fire up your text editor,
type the program up, save it to a file, compile it, work out all the
syntax errors, link, run, test on known cases, then use it to solve
the cases you don't yet have a solution for.
Is it possible that there is no existing library for that out there
(expect something that big like the gnu scientific library)?

Yes, it is possible. Have you tried looking on the Web?
I searched the groups but couldn't find some good answers to this
question except something like "Hey you - why are you posting that? We
already answered this stuff." but without some _usefull_ links.

Oh... We're sorry. Here is the link where I'd start looking:

www.google.com (don't say I didn't provide any links; I bet that
Google has billions of links available for consumption), or, if you
prefer German, try www.google.de
Of course I can write something on my one - which I actually did - but
then I have to handle with problems like type-overflow and the
largeness of some factorials (which I can actually compute till 12
with datatype long - not big at all).

Oh, yeah. I know what you mean. All those problems with program
writing and debugging -- one actually needs to make programs *work*
before they can *work for him*. Been there, done that. Every day
(well almost), as a matter of fact.
So if someone out there knows a good solution for this - I would be
very appreciative.

Try the Google thing, you might actually find it useful, and not just
for this particular case.

V
 
O

osmium

I'm very sorry for maybe posting something which was already posted.

--> How can I compute the binomial coefficient in C++? <--

I would start here. On things of this size and complexity, I often have the
feeling that doing it myself might actually be faster. The alternative is
to find the code, get used to the - probably minimal - documentation, try
it, and hope that the guy that wrote it took care of all the corner cases.
I would guess the threshold to have code accepted might not be really,
really high.

I would look at the C stuff first, I don't think the underlying problem
warrants the complexity of C++.

http://www.snippets.org/
 
I

Ikaro

You write a program that does that. You fire up your text editor,
type the program up, save it to a file, compile it, work out all the
syntax errors, link, run, test on known cases, then use it to solve
the cases you don't yet have a solution for.


Yes, it is possible. Have you tried looking on the Web?


Oh... We're sorry. Here is the link where I'd start looking:

www.google.com (don't say I didn't provide any links; I bet that
Google has billions of links available for consumption), or, if you
prefer German, trywww.google.de


Oh, yeah. I know what you mean. All those problems with program
writing and debugging -- one actually needs to make programs *work*
before they can *work for him*. Been there, done that. Every day
(well almost), as a matter of fact.


Try the Google thing, you might actually find it useful, and not just
for this particular case.

V


I don't understant this bitter attitude, specially in a newsgroup.
From what I can tell the author is asking a valid question and seem to
have done some research.

If you don't want/can't help, at least stay off the topic.
Last time I checked nobody is forced to respond to topics here.
 
V

Victor Bazarov

Ikaro said:
I don't understant this bitter attitude, specially in a newsgroup.

"Bitter"?

To all: does this really come across as bitter?

Yes. So? Is that an excuse? Does the general validity of the
question or having done "some research" qualify the inquirer for
charitable donation of code? Or what would Your Majesty accept
as a deserving response? And if such response exists, why didn't
Your Majesty provide it yourselves?
If you don't want/can't help, at least stay off the topic.

I think I did help. If you don't want/can't recognize my help here,
at least stay off my back.
Last time I checked nobody is forced to respond to topics here.

Exactly!

V
 
M

mail

Hi

First at all thanks to osmium and Icaro. The link is very helpfull,
although I think there doesn't exist something like a library for this
problem - which I am really surprised of, cause I don't think I am the
only one who needs this function ...

Victor? I'm not sure that you know what you are doing here ...
Actually your answer indeed didn't help me anything - apart from
feeling defensive. Don't you have better things to do??

- Egg
 
V

Victor Bazarov

First at all thanks to osmium and Icaro. The link is very helpfull,
although I think there doesn't exist something like a library for this
problem - which I am really surprised of, cause I don't think I am the
only one who needs this function ...

Victor? I'm not sure that you know what you are doing here ...
Actually your answer indeed didn't help me anything - apart from
feeling defensive. Don't you have better things to do??

Listen, having spent years in this newsgroup, I've seen scores if not
hundreds of individuals like yourself who, for the lack of better word,
seem *incapable* of the simple task of locating something right under
their nose, be it an algorithm, a page from a manual, or some source
code solving a commonly known problem. And all they do is complain
when somebody just points them to a library catalog, a web search
engine, or to a book. "WHAT? Do I have to actually use the index of
the book to locate what I need? Are you kidding me?"

Now, I just went to Google and searched for "calculate binomial
coefficient c++ code" (without the quotes). What do you know, the
very first page of results is *filled* with links to C++ code that
calculates binomial coefficients. I have HARD TIME BELIEVING that
you had done ANY "research".

So, please forgive me if I don't feel any compassion towards people
like you.

And, for the record, I am here to discuss C++ language. And make
people like you realise that their attitude toward the rest of us
is questionable. Please feel free to feel defensive. The more
you do, the less chance there is you'll come back asking to locate
some source code or library for you.

V
 
O

osmium

First at all thanks to osmium and Icaro. The link is very helpfull,
although I think there doesn't exist something like a library for this
problem - which I am really surprised of, cause I don't think I am the
only one who needs this function ...

You have to be alert for synonym's and what some people might think are
synonyms.


I did a google search for <"pascal's trinagle" code c> and trhe second hit
(CS1003, which I looked at first) seems to have code for a recursive
Pascal - the language - code. I figure most programmers should be able to
_read_ (but not write) Pascal. And if I were suufficiently driven I could
probably find something better.
 
R

red floyd

Hi

First at all thanks to osmium and Icaro. The link is very helpfull,
although I think there doesn't exist something like a library for this
problem - which I am really surprised of, cause I don't think I am the
only one who needs this function ...

Victor? I'm not sure that you know what you are doing here ...
Actually your answer indeed didn't help me anything - apart from
feeling defensive. Don't you have better things to do??

Victor may have been a bit snippy, but the question was off topic here.

When you post, ask yourself, "Would the answer be essentially the same
if it was in another language than C++?" If you reply "yes", then it's
OT here, and probably belongs in comp.programming, comp.graphics,
comp.object, comp.algorithms, etc...

Then ask yourself, "Does this question make sense if I go to another
platform (e.g. Linux instead of Windows)". If the answer is no, then
you're better off asking in a platform-specific newsgroup
(microsoft.public.*, comp.unix.*).

The OP's question fails the first test -- it's not a C++ specific
question, hence it doesn't belong here.

Please see the FAQ (http://www.parashift.com/c++-faq-lite) for this
group, in particular the netiquette section -- section 5
http://www.parashift.com/c++-faq-lite/how-to-post.html

Thanks
 
M

mail

Hi

Thanks for your help. I admit that I'm not a google-groups profi yet.
Sorry for that.

Greetings
- Egg
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

Hi

Thanks for your help. I admit that I'm not a google-groups profi yet.
Sorry for that.

Then I'll teach you a bit more. comp.lang.c++ and a lot of other groups
are not Google groups, but newsgroups (or usenet groups). Google groups
is just an interface through which you can access them (an not a very
good one either), and some other Google specific groups.
 
J

Jim Langston

red floyd said:
Victor may have been a bit snippy, but the question was off topic here.

When you post, ask yourself, "Would the answer be essentially the same if
it was in another language than C++?" If you reply "yes", then it's OT
here, and probably belongs in comp.programming, comp.graphics,
comp.object, comp.algorithms, etc...

Then ask yourself, "Does this question make sense if I go to another
platform (e.g. Linux instead of Windows)". If the answer is no, then
you're better off asking in a platform-specific newsgroup
(microsoft.public.*, comp.unix.*).

The OP's question fails the first test -- it's not a C++ specific
question, hence it doesn't belong here.

Please see the FAQ (http://www.parashift.com/c++-faq-lite) for this group,
in particular the netiquette section -- section 5
http://www.parashift.com/c++-faq-lite/how-to-post.html

Also ask yourself, "did I google for the answer first?"

If an answer is easily found by googling it, that's what you'll usually get
from the newsgroup, try www.google.com, which is what you got. If you don't
know how to use google, learn.
 
O

osmium

Jim Langston said:
If an answer is easily found by googling it, that's what you'll usually
get from the newsgroup, try www.google.com, which is what you got. If you
don't know how to use google, learn.

As I understand it from what he said, the OP searched Usenet (google groups)
instead of searching the Web (using the google search engine). That was his
basic mistake and I can sympathize with that; most of us have to learn
things, our instincts aren't as highly developed as most animals. .
 

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
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top