Does anyone know what the 'size' of a Binary Tree is?
By that I mean is it the number of nodes contained in it, or the height?
I don't think it means the height of a tree but you never know...
Printable View
Does anyone know what the 'size' of a Binary Tree is?
By that I mean is it the number of nodes contained in it, or the height?
I don't think it means the height of a tree but you never know...
I suppose size could mean almost anything. I think one important metric would be the number of bytes that comprise the tree, which should be the number of nodes times the number of bytes per node.
cudabean
Size = depth of the tree in almost all the cases I have seen.
Well, I think the size has got something to do with the number of nodes as opposed to the memory that the Tree takes up.
Last week we were asked to write a method that computed the height of a Tree and it seems strange that we would be asked to do it again.
i would go with number of nodes if it isnt the depth aka height.
Probably have to traverse the tree from left to right until you find the last node, then mark that as the deepest point.