Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #8252
| From | root <NoEMail@home.org> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: Looking for simple brute force solution |
| Date | 2018-01-04 09:42 +0000 |
| Organization | Linux Advocacy |
| Message-ID | <p2kstv$o1a$1@news.albasani.net> (permalink) |
| References | <p2jobe$48s$1@news.albasani.net> <Djg3C.31394$uY5.18424@fx21.iad> |
Richard Damon <Richard@Damon-Family.org> wrote:
>
> Brute force method:
>
> One simple method would be to have an array, the same size as the number
> of numbers, with values representing the options, maybe 0 for ignore, 1
> to add, -1 to subtract.
>
> 1) Start all elements a 0.
>
> 2) process.
>
> 3) Take the first element, move it to the next value in the sequence,
> 0 -> 1 -> -1 -> 0
>
> if it became 0, then move to the next element and repeat until you
> sequence and element and it doesn't become 0, or you run out of elements
> (then you are done).
>
> go back to 2 and process
>
>
> This is basically counting base 3.
>
I can only see how to do this with a sequence of N nested loops.
Each loop is of the form:
for(j=-1;j<2;++j){
....
}
which is how I started. Programming this is rather cumbersome
so I was hoping to find another approach.
The problem becomes combinatorially explosive for N between
10 and 20.
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-03 23:18 +0000
Re: Looking for simple brute force solution fir <profesor.fir@gmail.com> - 2018-01-03 16:49 -0800
Re: Looking for simple brute force solution fir <profesor.fir@gmail.com> - 2018-01-03 17:11 -0800
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 10:14 +0000
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 10:52 -0500
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 16:46 +0000
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 12:37 -0500
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-03 21:28 -0500
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 09:42 +0000
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 10:16 -0500
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 17:26 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 21:19 +0000
Re: Looking for simple brute force solution Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-01-04 02:29 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 09:55 +0000
Re: Looking for simple brute force solution Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-01-04 14:29 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 16:55 +0000
Re: Looking for simple brute force solution Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-01-04 20:36 +0000
Re: Looking for simple brute force solution Robert Wessel <robertwessel2@yahoo.com> - 2018-01-04 12:03 -0600
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 21:28 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 21:50 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 23:06 +0000
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 21:35 -0500
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-05 05:59 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-05 16:48 +0000
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-06 08:50 -0500
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-06 16:47 +0000
csiph-web