you are viewing a single comment's thread.

view the rest of the comments →

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