Talk:Same fringe: Difference between revisions

(→‎Pythons binary tree representation: representing CDRs with built-in list or tuple seems fine to me)
Line 35:
The [http://docs.python.org/library/itertools.html#itertools.izip_longest itertools.izip_longest] function pairs the successive members of two 'trees' together allowing them to be tested for equality one pair of terms at a time. The [http://docs.python.org/library/functions.html?highlight=all#all all] function short circuit evaluates and will return false as soon as the next pair of terms are unequal. The izip_longest function is set to pad a shorter 'tree' with the None value which should not be a member of either tree.<br>--[[User:Paddy3118|Paddy3118]] 15:46, 14 August 2012 (UTC)
:I think your representation of binary trees is fine, even if it doesn't have explicit CDR pointers. That is, as long as the algorithm has to choose "left" or "right", it's an okay representation. To push it a bit further, a string representation of the whole tree would not be okay if the leaves were extracted directly from the string, but probably would be okay if a stack of cursors were navigating around the string making those left/right/down/up decisions. --[[User:TimToady|TimToady]] 17:35, 14 August 2012 (UTC)
 
::Thanks. --[[User:Paddy3118|Paddy3118]] 22:00, 14 August 2012 (UTC)
Anonymous user