[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Algorithms thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 32
Thread images: 11

File: Whiteboard_with_markers.jpg (146KB, 1840x1123px) Image search: [Google]
Whiteboard_with_markers.jpg
146KB, 1840x1123px
You have 30 seconds to invert a binary tree. Go.
>>
File: 1447990890055.jpg (143KB, 1840x1123px) Image search: [Google]
1447990890055.jpg
143KB, 1840x1123px
d-did i do it?
>>
File: 0.jpg (136KB, 1840x1123px) Image search: [Google]
0.jpg
136KB, 1840x1123px
rolling
>>
>>51430423
this is NSFW
>>
>>51430394
return 1/tree
>>
File: done.jpg (169KB, 1840x1123px) Image search: [Google]
done.jpg
169KB, 1840x1123px
>>51430394
>>
>>51430480
>binary tree
>>
>>51430480
Congrats. You got the job!
>>
>>51430487
>trinary bee
>>
File: beetree.png (55KB, 640x400px) Image search: [Google]
beetree.png
55KB, 640x400px
>>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.
>>
File: 1439199406760.gif (368KB, 380x298px) Image search: [Google]
1439199406760.gif
368KB, 380x298px
>>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());
}
}
>>
File: 1447990890055 - Copy.jpg (222KB, 1840x1123px) Image search: [Google]
1447990890055 - Copy.jpg
222KB, 1840x1123px
>>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.
>>
File: invtree.jpg (241KB, 1840x1123px) Image search: [Google]
invtree.jpg
241KB, 1840x1123px
>>51430889
Step it up.
>>
>>51430904
...and tweetdeck and contributed to KDE in the early stages.
>>
File: 1447993317866.jpg (368KB, 1840x1123px) Image search: [Google]
1447993317866.jpg
368KB, 1840x1123px
>>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
>>
File: 1375264300497.jpg (121KB, 377x449px) Image search: [Google]
1375264300497.jpg
121KB, 377x449px
>>51431055
Maybe that's what they were intending. To see if he would ask qualifying questions.
>>
File: ar13109851195143.jpg (457KB, 800x600px) Image search: [Google]
ar13109851195143.jpg
457KB, 800x600px
Thread posts: 32
Thread images: 11


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.