- binary tree: how did you learn it? - 1 Update
Ben Bacarisse <ben.usenet@bsb.me.uk>: Mar 10 09:57PM >>I'm doing some informal research for a talk I'll be giving, >>and what I'm interested in is firstly: how did you learn to >>program a binary tree in C++? <cut> > tree := pair | leave. > leave := atom. > pair :=( tree, tree ). This definition does not appear to include the empty tree. Reading on, you reference Lisp, so maybe the empty tree is represented by a special atom. That works, of course, but it's not obvious from your notation. > excellence, since its data structures: the atom and the > dotted pair (or, "it's functions »CONS«, »CAR« and »CDR«") > are exactly what is needed to create a binary tree. You may be talking the OP rather too literally. I am pretty sure they mean binary /search/ trees and for that, even in Lisp, you need to decide how to represent a node. A plain tree of cons cells with atoms at the leaves is not efficiently searchable. -- Ben. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment