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


Groups > comp.lang.python > #26328

Re: Why 'Flat is better than nested'

References <jv9h9i$7o1$1@dough.gmane.org> <CAAax9+ogjeQY4jFj2r_fnBwNiagDRZ2Pg0yWTWuV+ns17VKqjQ@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2012-07-31 15:49 -0600
Subject Re: Why 'Flat is better than nested'
Newsgroups comp.lang.python
Message-ID <mailman.2797.1343771377.4697.python-list@python.org> (permalink)

Show all headers | View raw


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.

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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Why 'Flat is better than nested' Ian Kelly <ian.g.kelly@gmail.com> - 2012-07-31 15:49 -0600

csiph-web