Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26331
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'binary': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Why': 0.09; 'terry': 0.09; 'trees': 0.09; 'applies': 0.15; 'entities.': 0.16; 'message-id:@dough.gmane.org': 0.16; 'nodes': 0.16; 'nodes.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'otherwise,': 0.20; 'trying': 0.21; '31,': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'looks': 0.26; 'url:wiki': 0.26; 'right.': 0.27; 'forgive': 0.27; 'tree': 0.27; 'header:X-Complaints-To:1': 0.28; 'leaves': 0.29; 'node': 0.29; 'parent': 0.29; 'url:wikipedia': 0.29; 'could': 0.32; 'to:addr:python-list': 0.33; 'point.': 0.33; 'pm,': 0.35; 'there': 0.35; 'received:org': 0.36; 'except': 0.36; 'url:org': 0.36; 'child': 0.36; 'two': 0.37; 'quite': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'url:en': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'more': 0.63; 'limit': 0.65; 'total': 0.65; 'jul': 0.65; 'everything.': 0.84; 'received:fios.verizon.net': 0.84; 'subject:better': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: Why 'Flat is better than nested' |
| Date | Tue, 31 Jul 2012 19:57:24 -0400 |
| References | <jv9h9i$7o1$1@dough.gmane.org> <CAAax9+ogjeQY4jFj2r_fnBwNiagDRZ2Pg0yWTWuV+ns17VKqjQ@mail.gmail.com> <CALwzid=snoC_Wm5H+0MKJ99xSVvTu1nyc6jLgz=Ky6F7N7YDag@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-251-66.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 |
| In-Reply-To | <CALwzid=snoC_Wm5H+0MKJ99xSVvTu1nyc6jLgz=Ky6F7N7YDag@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2800.1343779070.4697.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1343779070 news.xs4all.nl 6970 [2001:888:2000:d::a6]:41819 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:26331 |
Show key headers only | View raw
On 7/31/2012 5:49 PM, Ian Kelly wrote: > On Tue, Jul 31, 2012 at 3:28 PM, Ifthikhan Nazeem <iftecan2000@gmail.com> wrote: >> as many as (about) 2*N - log2(N) parent child relationships >> >> I would like to know how did you come up with the above formula? Forgive my >> ignorance. By non-rigorous experimentation, which did not quite count everything. > I come up with 2N - 2 myself. If there are N leaf nodes and N - 1 > non-leaf nodes, then there are 2N - 1 total nodes, each of which has > one parent except for the root. That's 2N - 2 parent-child > relationships. That looks right. I was trying to think recursively, which in this case is more rather than less complicated. That actually sharpens my original point. N-1 new nodes and 2N-2 new relationships is 3N-3 new entities. The internal node limit of N-1 only applies to full-proper-strict binary trees without one-child internal nodes. Otherwise, a single leaf node could have an indefinite number of ancestors. from https://en.wikipedia.org/wiki/Binary_tree "A full binary tree (sometimes proper binary tree or 2-tree or strictly binary tree) is a tree in which every node other than the leaves has two children." -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Why 'Flat is better than nested' Terry Reedy <tjreedy@udel.edu> - 2012-07-31 19:57 -0400
csiph-web