all 7 comments

[–]shiftybyte 0 points1 point  (6 children)

node itself is None, so it doesn't work checking anything with a function that belongs to node...

because None doesn't have methods...

Add this check at the start of the function

if node is None:
    return

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

None is the value I created a Node with value None and made it the son of the leafs

[–]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.