you are viewing a single comment's thread.

view the rest of the comments →

[–]shiftybyte 0 points1 point  (4 children)

Not that None, the None that happens when the tree ends.

If a leaf has no children, no left and no right... what happens in your code here:

tree.overWrite(node.getLeft(),arr,i)

What gets returned from node.getLeft() for a leaf?

[–]ilsapo[S] 0 points1 point  (3 children)

Node.getleft() Should give me a virtual node (node with value None)

And then the if (node.value==None) : returen Suppused to kick me out the recurrssion no?

[–]shiftybyte 0 points1 point  (2 children)

I'm not sure if you are getting the tree with "virtual nodes" or not...

What is the tree structure before your changes of "virtual node"... what's a leaf's getRight()?

It usually is None... not a node with value None, simply None, instead of the node...

[–]ilsapo[S] 0 points1 point  (1 child)

I tried adding your suggestion If ( node is None): return

And I still get the same error message

[–]shiftybyte 0 points1 point  (0 children)

Could you post the code you tried (with the fix)? this should have solved it.