Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #147547
| Path | csiph.com!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail |
|---|---|
| From | nobody@example.org (Scott) |
| Newsgroups | comp.lang.c |
| Subject | Re: So here's a fun challenge |
| Date | Sun, 03 Nov 2019 17:35:02 GMT |
| Organization | XMission http://xmission.com/ |
| Message-ID | <5dbf0295.12592219@core> (permalink) |
| References | <NNgvF.21265$hh5.17108@fx07.iad> |
| Injection-Info | news.xmission.com; posting-host="shell.xmission.com:2607:fa18:0:beef::4"; logging-data="24132"; mail-complaints-to="abuse@xmission.com" |
| X-Newsreader | Forte Free Agent 1.21/32.243 |
| Xref | csiph.com comp.lang.c:147547 |
Show key headers only | View raw
On Sat, 2 Nov 2019 10:53:01 -0400, DFS <nospam@dfs.com> wrote:
>- create 2 (equal or unequal sized) arrays of random strings of random
> lengths from low to high, ie 2 to 4, or 8 to 16, etc
>- manually add a few of the same values to each array to ensure dupes
>- print the top and bottom 10 to show initial data set
>- combine the arrays
>- case-insensitive sort the arrays (I use qsort but any method is fine)
>- dedupe the combined array
>- add the unique vals to a new array that's sized appropriately
>- print the top and bottom 10 to show final sorted data
Data points for you - Win10, Intel i5-8600 @3.6GHz. I just copied your
code (I may attempt my own later):
randclc 1000000 8 16
= 1.30 s
python randclc.py 1000000 8 16
= 8.61 s (6.62x)
randclc 10000000 8 16
= 18.95 s
python randclc.py 10000000 8 16
= 95.10 s (5.02x)
randclc 50000000 8 16
= 124.19 s
python randclc.py 50000000 8 16
= did not finish:
Traceback (most recent call last):
File "randclc.py", line 9, in <module>
randoms1.append(''.join([random.choice(string.ascii_letters +
string.digits) for x in xrange(random.randint(lo,hi))]))
MemoryError
randclc 100000000 8 16
= 279.29 s
python randclc.py 100000000 8 16
= did not attempt
I don't know enough about Python to say why it errored out. There
should be plenty of RAM, unless it's using a lot more than I'd guess.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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