Python is not bad ;-)

Ian Kelly ian.g.kelly at gmail.com
Sat May 2 13:17:17 EDT 2015


On Sat, May 2, 2015 at 9:53 AM, Joonas Liik <liik.joonas at gmail.com> wrote:

Top-posting is heavily frowned at on this list, so please don't do it.

> Balancing of trees is kind of irrelevant when "tree" means "search space"
> no?

I think it's relatively rare that DFS is truly the best algorithm for
such a search. For one thing, "search space" often means "graph", not
"tree". And for any other type of search, you'll want/need to
implement it iteratively rather than recursively anyway.

> And you definitely dont need to keep the entire tree in memory at the same
> time.

You could harness every single storage device on the planet and you
would still not have nearly enough capacity to fill a balanced search
tree to a depth of 1000.

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

It is. My point was that if your unbalanced search tree is getting to
a depth of 1000, then it's probably long past time for you to start
thinking about optimizing it *anyway*.



More information about the Python-list mailing list