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


Groups > comp.lang.c > #147514

Re: So here's a fun challenge

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>
From Richard Damon <Richard@Damon-Family.org>
Message-ID <PllvF.9314$fL4.4777@fx41.iad> (permalink)
Organization Forte - www.forteinc.com
Date 2019-11-02 16:07 -0400

Show all headers | View raw


On 11/2/19 3:38 PM, Bart wrote:
> On 02/11/2019 19:01, Richard Damon wrote:
>> On 11/2/19 1:08 PM, Bart wrote:
>>>
>>> Does the Python not de-dupe?
>>
>> Lists, which the program is using can store duplicate values, as they
>> are different because they are at different indexes (Lists have an
>> order).
>>
>> Sets, which is what the program uses to dedup, do not store duplicate
>> values, but also does not maintain an order (sets are built on hash
>> tables).
>>
>> Passing the data through a set before sorting removes all the duplicates.
>>
>>
>> Lists would be broken if they did not store duplicates.
>> The sort function would be broken if it eliminated duplicates.
> 
> 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
> 

The line:
randsorted = sorted(set(randoms1+randoms2),key=str.lower)

should create a new list with no duplicates which has been sorted.
It does NOT change the randoms1 or randoms2 to remove the duplicates
from them.

Where are you seeing duplicates

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