Trees

Paul Rubin no.email at nospam.invalid
Wed Jan 21 23:27:37 CET 2015


Rustom Mody <rustompmody at gmail.com> writes:
> Thats not bfs. That's inorder traversal

Oops, you're right.  How's this:

bfs x = go [x] where
  go [] = []
  go (L x:ts) = x:go ts
  go (B x lst rst:ts) = x : go (ts ++ [lst, rst])

*Main> bfs t
[6,2,8,1,4,7,9,3,5]



More information about the Python-list mailing list