You have 30 seconds to invert a binary tree. Go.
d-did i do it?
rolling
>>51430423
this is NSFW
>>51430394return 1/tree
>>51430480
>binary tree
>>51430480
Congrats. You got the job!
>>51430487
>trinary bee
>>51430491
>>51430467
no, it is a nose. a very jewish nose...
>>51430394
Fuck this shit I'll just send a resume to Apple Inc. instead.
>>51430594
best answer
invert(node *root) {
if (*root != NULL) {
swap (root->left,root->right);
invert(node->right);
invert(node->left);
}
}
>b-but Google engineers use my code
>>51430685
Who the fuck is that guy anyway?
>>51430720
https://twitter.com/mxcl/status/608682016205344768
>>51430394(define (invert-tree tree)
(if (empty-tree? tree)
the-empty-tree
(make-tree (invert-tree (right-branch tree))
(invert-tree (left-branch tree)))))
Assuming binary trees are implemented, that is.
>>51430725
I still don't get why it became such a big deal. Is he famous?
>>51430759
>mess up the indentation
>the last words and parentheses line up
How serendipitous.
>>51430781
That is just sad.
I'm not smart, I study Information Systems in a REALLY shit university in Brazil, we don't even study algorithms and I could solve that, first try.
>>51430394
void invert(node* root){
if(*root != nullptr){
*root->setData(1/root->getData());
invert(root->getRight());
invert(root->getLeft());
}
}
>>51430480
those aren't a tree
>>51430835
Yeah, I get that, the guy is a retard. I just wasn't sure why everybody started talking about it. Apparently he is responsible for some MacOS package manager.
>>51430889
Step it up.
>>51430904
...and tweetdeck and contributed to KDE in the early stages.
>>51430889
>no binary
>>51430784
the word right having more letters than the word left is serendipitous? how so?
>>51430975
Interesting... Do you think he just didn't understand a question? Or maybe he was nervous?
>>51431033
>he just didn't understand a question
I think this is the case. "Inverting a binary tree" is vague as fuck. It sounds like they want the tree turned upside-down or restructured in another way. Not just a simple left-right swap of every node's children.
>>51431031
>make mistake
>still works out fine, in a sense
>>51431055
Maybe that's what they were intending. To see if he would ask qualifying questions.