Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #127954

Re: Copy array with small changes

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Copy array with small changes
Date 2018-03-17 18:04 +0000
Organization A noiseless patient Spider
Message-ID <87605u7f3r.fsf@bsb.me.uk> (permalink)
References <p848dh$oko$1@dont-email.me> <slrnpac9bc.eu5.grahn+nntp@frailea.sa.invalid> <p864ci$btf$1@dont-email.me> <87sh95ur60.fsf@bsb.me.uk> <kfnmuz6pt4c.fsf@x-alumni2.alumni.caltech.edu>

Show all headers | View raw


Tim Rentsch <txr@alumni.caltech.edu> writes:

> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>
>> Noob <root@127.0.0.1> writes:
>>
>>> On 12/03/2018 07:59, Jorgen Grahn wrote:
>>
>> <snip>
>>
>>>> Because the function's task is so strange, I get the feeling that it
>>>> may be worth refactoring the code as a whole.  For example, it's
>>>> called "update_array" -- are you overwriting the same array with
>>>> basically the same data, over and over again?
>>>>
>>>> I'm partly asking because with the requirements you have on
>>>> update_array(), I don't think it can be made internally elegant.
>>>
>>> OK, you want the big picture :-)
>>>
>>> The task is to evaluate all arithmetic expressions involving
>>> N numbers and the 4 arithmetic operators [+ - * /]
>>
>> And its Catalan numbers again!
>
> Not quite Catalan numbers, because any of the N choose 2
> possibilities can be combined, not just adjacent ones.
> Right?

I'm not sure what you mean.  If you build all the complete binary trees
with 0, 1, 2... operators you get the Catalan numbers.  Each of these
C(n) trees can then have 4^n operators "plugged" in, and each of these
can be applied to the permutations of N choose (n+1) numbers.

(Given what's now know about the problem, this is not a good way to do
it though.)

-- 
Ben.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Copy array with small changes Noob <root@127.0.0.1> - 2018-03-11 22:51 +0100
  Re: Copy array with small changes supercat@casperkitty.com - 2018-03-11 15:11 -0700
  Re: Copy array with small changes Richard Damon <Richard@Damon-Family.org> - 2018-03-11 18:12 -0400
    Re: Copy array with small changes Spiros Bousbouras <spibou@gmail.com> - 2018-03-11 22:35 +0000
      Re: Copy array with small changes Richard Damon <Richard@Damon-Family.org> - 2018-03-13 13:10 -0400
  Re: Copy array with small changes Spiros Bousbouras <spibou@gmail.com> - 2018-03-11 22:13 +0000
    Re: Copy array with small changes Spiros Bousbouras <spibou@gmail.com> - 2018-03-12 00:04 +0000
    Re: Copy array with small changes bartc <bc@freeuk.com> - 2018-03-12 10:35 +0000
      Re: Copy array with small changes Spiros Bousbouras <spibou@gmail.com> - 2018-03-12 12:37 +0000
        Re: Copy array with small changes bartc <bc@freeuk.com> - 2018-03-12 13:10 +0000
        Re: Copy array with small changes Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-03-12 13:34 +0000
          Re: Copy array with small changes Tim Rentsch <txr@alumni.caltech.edu> - 2018-03-17 09:22 -0700
        Re: Copy array with small changes mark.bluemel@gmail.com - 2018-03-12 07:47 -0700
          Re: Copy array with small changes bartc <bc@freeuk.com> - 2018-03-12 14:56 +0000
            Re: Copy array with small changes Spiros Bousbouras <spibou@gmail.com> - 2018-03-12 15:14 +0000
            Re: Copy array with small changes mark.bluemel@gmail.com - 2018-03-12 08:53 -0700
        Re: Copy array with small changes Keith Thompson <kst-u@mib.org> - 2018-03-12 09:08 -0700
          Re: Copy array with small changes supercat@casperkitty.com - 2018-03-12 09:57 -0700
            Re: Copy array with small changes Richard Damon <Richard@Damon-Family.org> - 2018-03-13 13:21 -0400
    Re: Copy array with small changes Noob <root@127.0.0.1> - 2018-03-12 15:25 +0100
      Re: Copy array with small changes Spiros Bousbouras <spibou@gmail.com> - 2018-03-12 15:09 +0000
  Re: Copy array with small changes Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-03-12 06:59 +0000
    Re: Copy array with small changes Noob <root@127.0.0.1> - 2018-03-12 15:55 +0100
      Re: Copy array with small changes bartc <bc@freeuk.com> - 2018-03-12 15:07 +0000
      Re: Copy array with small changes mark.bluemel@gmail.com - 2018-03-12 09:03 -0700
      Re: Copy array with small changes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-03-12 17:42 +0000
        Re: Copy array with small changes Noob <root@127.0.0.1> - 2018-03-12 23:33 +0100
          Re: Copy array with small changes Wouter Verhelst <w@uter.be> - 2018-03-12 23:44 +0100
          Re: Copy array with small changes Tim Rentsch <txr@alumni.caltech.edu> - 2018-03-17 09:48 -0700
            Re: Copy array with small changes Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-18 03:31 -0700
            Re: Copy array with small changes Noob <root@127.0.0.1> - 2018-03-22 17:10 +0100
        Re: Copy array with small changes Tim Rentsch <txr@alumni.caltech.edu> - 2018-03-17 09:24 -0700
          Re: Copy array with small changes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-03-17 18:04 +0000
            Re: Copy array with small changes Tim Rentsch <txr@alumni.caltech.edu> - 2018-03-26 22:55 -0700
              Re: Copy array with small changes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-03-27 15:28 +0100
                Re: Copy array with small changes Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-28 14:42 -0700
      Re: Copy array with small changes Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-03-13 12:46 +0000
  Re: Copy array with small changes Anton Shepelev <anton.txt@gmail.com> - 2018-03-12 22:36 +0300
  Re: Copy array with small changes Wouter Verhelst <w@uter.be> - 2018-03-12 23:32 +0100
    Re: Copy array with small changes Wouter Verhelst <w@uter.be> - 2018-03-13 10:42 +0100
    Re: Copy array with small changes Noob <root@127.0.0.1> - 2018-03-13 11:37 +0100
      Re: Copy array with small changes Wouter Verhelst <w@uter.be> - 2018-03-13 21:27 +0100
  Re: Copy array with small changes Tim Rentsch <txr@alumni.caltech.edu> - 2018-03-17 09:55 -0700

csiph-web