Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16652
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <dihedral88888@googlemail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.103 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.79; '*S*': 0.00; 'behave': 0.07; 'python': 0.08; 'reply-to:addr:comp.lang.python': 0.09; 'to:addr:comp.lang.python': 0.09; 'accesses': 0.16; 'computation': 0.16; 'integers.': 0.16; 'subject:independent': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.18; 'computing': 0.18; 'yet.': 0.18; 'cc:no real name:2**0': 0.20; "doesn't": 0.22; 'header:In- Reply-To:1': 0.22; 'table.': 0.23; 'cc:addr:gmail.com': 0.28; 'needed,': 0.28; 'sound': 0.28; 'elements': 0.29; 'mapping': 0.29; 'cc:addr:python.org': 0.29; 'hash': 0.30; 'subject:?': 0.31; "i'll": 0.31; 'go.': 0.32; 'list': 0.32; 'sort': 0.33; "won't": 0.33; 'header:User-Agent:1': 0.33; 'agree': 0.33; 'from:addr:googlemail.com': 0.34; 'too': 0.34; 'things': 0.34; 'operations': 0.35; 'cc:2**1': 0.36; 'members': 0.37; 'two': 0.37; 'but': 0.37; 'list,': 0.37; 'received:google.com': 0.37; 'could': 0.37; 'bunch': 0.38; 'monday,': 0.38; 'some': 0.38; 'received:209.85': 0.38; 'should': 0.39; "it's": 0.40; 'received:209': 0.40; 'might': 0.40; 'once': 0.60; 'range': 0.61; 'more': 0.61; '2011': 0.61; 'your': 0.61; 'life': 0.64; 'methods:': 0.67; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'reply-to:addr:googlegroups.com': 0.74; 'often,': 0.84; 'received:209.85.216.184': 0.84; 'received:mail- qy0-f184.google.com': 0.84; 'scatter': 0.84; 'fast,': 0.91; 'sum.': 0.91 |
| Newsgroups | comp.lang.python |
| Date | Mon, 5 Dec 2011 04:09:34 -0800 (PST) |
| In-Reply-To | <mailman.3287.1323064211.27778.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=1.168.138.227; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw |
| References | <jb57p7$b1j$1@dough.gmane.org> <mailman.3287.1323064211.27778.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| MIME-Version | 1.0 |
| Subject | Re: order independent hash? |
| From | 88888 Dihedral <dihedral88888@googlemail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | Neal Becker <ndbecker2@gmail.com>, python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | comp.lang.python@googlegroups.com |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Message-ID | <mailman.3297.1323086977.27778.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1323086977 news.xs4all.nl 6973 [2001:888:2000:d::a6]:33960 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:16652 |
Show key headers only | View raw
On Monday, December 5, 2011 1:50:08 PM UTC+8, Dan Stromberg wrote: > Two methods: > 1) If you need your hash only once in an infrequent while, then save > the elements in a list, appending as needed, and sort prior to > hashing, as needed > > 2) If you need your hash more often, you could keep your elements in a > treap or red-black tree; these will maintain sortedness throughout the > life of the datastructure. > > 3) If A bunch of log(n) or n or nlog(n) operations doesn't sound > appealing, then you might try this one: Create some sort of mapping > from your elements to the integers. Then just use a sum. This won't > scatter things nearly as well as a cryptographic hash, but it's very > fast, because you don't need to reevaluate some of your members as you > go. > > HTH > A sorted list can behave like a hash table. This is of O(log(n)) in accesses of n items in theory. I agree with you a hash key computation method too slow than a list of n items in accesses for a range of n items should be reloadable. But this is not supported in Python yet. For tedious trivial jobs of non-heavy computing , I'll opt for easy use.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: order independent hash? Dan Stromberg <drsalists@gmail.com> - 2011-12-04 21:50 -0800
Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-05 04:09 -0800
Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-05 04:09 -0800
Re: order independent hash? Dan Stromberg <drsalists@gmail.com> - 2011-12-05 15:05 -0800
csiph-web