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


Groups > comp.lang.c > #147538

Re: So here's a fun challenge

From DFS <nospam@dfs.com>
Subject Re: So here's a fun challenge
Newsgroups comp.lang.c
References <NNgvF.21265$hh5.17108@fx07.iad> <MKivF.33881$Yl3.11450@fx24.am4> <XnkvF.1114$bC3.644@fx08.iad> <1XkvF.120116$7ei.98248@fx36.am4>
Message-ID <qvBvF.6807$3u6.2802@fx34.iad> (permalink)
Organization blocknews - www.blocknews.net
Date 2019-11-03 09:29 -0500

Show all headers | View raw


On 11/2/2019 3:38 PM, Bart wrote:


> OK, I got the idea that duplicates would be eliminated completely (since 
> when I ran the Python, those extra duplicate values still appeared):
> 
> - dedupe the combined array
> - add the unique vals to a new array that's sized appropriately


To ensure I had dupes in the final array (before sorting and deduping), 
I added the set of dupes to each array, so when they're combined you have:

randoms1
These
are
the
dupe
values
for
each
array
randoms2
These
are
the
dupe
values
for
each
array


Then it sorts the array and removes one of each dupe from
'These','are','the','dupe','values','for','each','array'

If you saw two of any value from
  'These','are','the','dupe','values','for','each','array'
there's a problem.


comment out the 3rd line from the bottom (use #):
if i<10 or i>len(randsorted)-11:

and de-indent the next line:
print("%2d. %s" % (i+1,randsorted[i]))

and run it and it will show all the final elements.

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


Thread

So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-02 10:53 -0400
  Re: So here's a fun challenge Bart <bc@freeuk.com> - 2019-11-02 17:08 +0000
    Re: So here's a fun challenge Richard Damon <Richard@Damon-Family.org> - 2019-11-02 15:01 -0400
      Re: So here's a fun challenge Bart <bc@freeuk.com> - 2019-11-02 19:38 +0000
        Re: So here's a fun challenge Richard Damon <Richard@Damon-Family.org> - 2019-11-02 16:07 -0400
        Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-03 09:29 -0500
  Re: So here's a fun challenge Bart <bc@freeuk.com> - 2019-11-02 20:36 +0000
    Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-03 09:33 -0500
      Re: So here's a fun challenge Paul <nospam@needed.invalid> - 2019-11-03 20:53 -0500
  Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-03 14:33 +1300
    Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-03 14:35 +1300
      Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-03 00:18 -0400
        Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-03 18:02 +1300
          Re: So here's a fun challenge Bart <bc@freeuk.com> - 2019-11-03 11:19 +0000
            Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-04 00:33 +1300
          Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-03 09:39 -0500
    Re: So here's a fun challenge Autist <autist69@gmail.com> - 2019-11-03 11:16 +0100
      Re: So here's a fun challenge Autist <autist69@gmail.com> - 2019-11-03 11:29 +0100
      Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-03 23:34 +1300
      Re: So here's a fun challenge Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-03 11:04 +0000
        Re: So here's a fun challenge Autist <autist69@gmail.com> - 2019-11-03 14:56 +0100
          Re: So here's a fun challenge Autist <autist69@gmail.com> - 2019-11-03 15:36 +0100
  Re: So here's a fun challenge nobody@example.org (Scott) - 2019-11-03 17:35 +0000
    Re: So here's a fun challenge Ian Collins <ian-news@hotmail.com> - 2019-11-04 08:03 +1300
    Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-04 10:07 -0500
      Re: So here's a fun challenge nobody@example.org (Scott) - 2019-11-04 16:06 +0000
        Re: So here's a fun challenge DFS <nospam@dfs.com> - 2019-11-04 15:33 -0500

csiph-web