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

>Stop right there, you look suspicious >Prove you belong

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: 26
Thread images: 5

File: immigration-officer.jpg (50KB, 485x340px) Image search: [Google]
immigration-officer.jpg
50KB, 485x340px
>Stop right there, you look suspicious
>Prove you belong on /g/ by balancing this binary search tree

what do?
>>
>>59190605
>lol you tk him 2 da bar
>>
https://yro.slashdot.org/story/17/03/01/2114213/software-engineer-detained-at-jfk-given-test-to-prove-hes-an-engineer

He only had to verify that the binary tree is balanced. Just count left and right leafs recursively.
>>
>giving away your powerlevel
Sorry, but who is this guy called Four Chan?
>>
Hack the airport and crash all planes with no survivors
>>
I can't. I come here to shill Intel and Nvidia and Apple.
>>
>>59190614
I laughed harder than I should have.
>>
makes no sence cause its a 50% chance you get it right and 50% chance you get it wrong.
>>
>>59190605
>my apologies sir, heres my military id
>oh, have a good day sir. thank you for your service

easy
>>
>>59190605
First I go through the three using inorder traversal and save every node in an array. Then I take the middle element of the array and make it the root node and make the left subtree from the left subarray of the middle element and the right subtree from the right subarray.
>>
>scream racism
>>
>>59192184
wtf? is that even real or just gibberish
>>
>>59192214
>>/out/
>>
>>59192214
he's just a moron. ignore him.

the easiest answer is avl or red-black tree.

balanced enough.

to determine balance is literally asserting that all leaves--or lack thereof, are at the same level of depth.
>>
File: dafuq.jpg (6KB, 259x194px) Image search: [Google]
dafuq.jpg
6KB, 259x194px
>>59190605
TFW the TSA Agent told the Engineer his answer was wrong
>>
File: 1396900492608.jpg (28KB, 251x404px) Image search: [Google]
1396900492608.jpg
28KB, 251x404px
okay so i uhm bitshift everything using ~ operator and then uhhh i print fizzbuzz and then i uhmmmm

hold on let me check out my java booklet
>>
>>59190605
Sure, let me do a preorder traversal.
>>
I have no clue what this means therefore I definitely belong here
>>
File: 1474965655331.jpg (21KB, 600x338px) Image search: [Google]
1474965655331.jpg
21KB, 600x338px
>>59193674
>>
>>59190625
The only question I would have is "How balanced?"
Either you write the function to return a 2-tuple representing a rational of balanced-ness, or you write a function that says "yes/no" based on whether literally every node has either zero or two leaves.

If I wanted a balanced tree I'd just use AVL trees though.
>>
File: 1464269428086.jpg (58KB, 634x392px) Image search: [Google]
1464269428086.jpg
58KB, 634x392px
>He didn't know why manhole covers are round
>deport him
>>
>>59190605
that's it? You aren't going to impose how it has to be done or give me the time complexity of my solution? Christ the wall cannot come soon enough
>>
>AVL tree
Shit tier, barely better than a linked list.

>Red-black tree
Acceptable, good worst case performance, but poor average performance.

>B-tree
God-tier data structure offering excellent performance with any access pattern
>>
>>59190605
>muh thinkpad
>muh open sauce software
>>
>>59194876
>barely better than a linked list.

>O(logn) is barely better than O(n) when searching
>>
>>59190605
Have you tried turning it on and off again?

EZ
Thread posts: 26
Thread images: 5


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