Python is not bad ;-)

Joonas Liik liik.joonas at gmail.com
Sat May 2 11:53:24 EDT 2015


Balancing of trees is kind of irrelevant when "tree" means "search space"
no?
And you definitely dont need to keep the entire tree in memory at the same
time.

By cropping unsuitable branches early (and not keeping the entire tree in
memory)
it is quite easy to have more than 1000 of call stack and still have
reasonable
preformance. (some/many nodes have 0 or 1 children)

Also should not-running-out-of-call-stack really be the main reason to
balance trees?
That sounds like an optimisation to me ..

On 2 May 2015 at 18:45, Ian Kelly <ian.g.kelly at gmail.com> wrote:

> On Sat, May 2, 2015 at 5:42 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> > Christian Gollwitzer <auriocus at gmx.de>:
> >
> >> That's why I still think it is a microoptimization, which helps only
> >> in some specific cases.
> >
> > It isn't done for performance. It's done to avoid a stack overflow
> > exception.
>
> If your tree is balanced, then the number of items you would need to
> have to get a stack overflow exception would be approximately 2 **
> 1000, which you can't possibly hope to fit into memory.
>
> If your tree is unbalanced and you're getting a stack overflow
> exception, then maybe you should think about balancing it.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150502/da03bcff/attachment.html>


More information about the Python-list mailing list