You are viewing a single comment's thread. Return to all comments →
Here is my algorithm:
return root.data + sumBST(root.left) + sumBST(root.right)
left_hash = 1
left_hash = root.data - root.left.data
right_hash = 1
right_hash = root.right.data - root.data
return root.data * root.data + left_hash * right_hash
return nodeHash(root) + (11 * hashBST(root.left)) ^ (3 * hashBST(root.right))
if sumBST(root) == 28:
if root.data == 4 and root.left.data == 2 and root.right.data == 6:
if root.data == 512:
if sumBST(root.right) != 392448:
if sumBST(root.left) >= 130818:
if sumBST(root) == 496:
if hashBST(root) < 100000:
if sumBST(root) > 115 and sumBST(root) < 125:
if hashBST(root) > 50000:
You would be fired right away from a real job if you ever create a piece of code like this. Google "magic numbers" antipattern
That was advice, no? I think he'd benefit from it - I even explained myself to extent. Leave your personal concerns out of it
If that is insulting to you, u'd be surely fired from our company with the speed of lightning
Sergei82, your comments are hard for me to read because they are much more concerned with tearing down coder2000 than educating him.
I attempted to explain why his comments weren't constructive, but he wasn't listening. This is why I deleted my comments. I agree with you and said something similar, but he kept thinking I was insulted by his comments. It's unfortunate to see that another developer is being so judgemental and using insults instead of working together to make other developers better. Fortunately, the people that are open to teaching and providing constructive feedback are the ones that end up making the largest impact, and become the best developers. Hopefully he will think about his actions and decide to turn his attitude around.
I wouldn't want to work at your company. You're a dick if you think making comments like that is ok.
if you talk like that to a colleague, you'd be fired right away. Google "professionalism" antipattern.
Due to the truly baffling nature of this code, I found it shocking that you passed the 10 test cases provided. This code does not work:
[5, 5, 7, 10, 12, 14, 15, 16, 18, 20] fails
[1, 3, 6, 9, 10, 12, 15, 17, 19, 22] fails