ian.g.kelly at gmail.com
Thu Jan 22 07:56:03 CET 2015
On Wed, Jan 21, 2015 at 10:20 PM, Rustom Mody <rustompmody at gmail.com> wrote:
> On Thursday, January 22, 2015 at 4:25:03 AM UTC+5:30, Ian wrote:
>> On Tue, Jan 20, 2015 at 6:23 PM, Rustom Mody wrote:
>> > The Haskell is bullseye¹ in capturing the essense of a tree because
>> > conceptually a tree of type t is recursive in the sense that it can contain
>> > 2 subtrees -- (B x lst rst) -- or its a base case -- L x.
>> How do you create a tree containing an even number of elements under
>> this constraint?
> Not sure what you are asking...
> [And a text only group makes discussing pictur-esque things hard]
> What do you mean by 'element'?
> Leaf? Internal? Either?
By "element" I mean an individual datum contained in the tree.
Likewise the elements of a list are its contents.
Since each element is associated with a node, the question could
equally be phrased as "How do you create a tree containing an even
number of elements under this constraint?" The point I was driving at
is that the definition is incomplete -- in addition to being an
internal node or a leaf, a tree can also be empty. In fact I would
suggest that an empty tree should be the real base case, since what is
a leaf node but a node where both of its children are empty trees?
More information about the Python-list