Stop right there, you look suspicious

>Stop right there, you look suspicious
>Prove you belong on Sup Forums by balancing this binary search tree

what do?

Other urls found in this thread:

yro.slashdot.org/story/17/03/01/2114213/software-engineer-detained-at-jfk-given-test-to-prove-hes-an-engineer
twitter.com/SFWRedditImages

>lol you tk him 2 da bar

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.

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.

>my apologies sir, heres my military id
>oh, have a good day sir. thank you for your service

easy

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

wtf? is that even real or just gibberish

>>/out/

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.

TFW the TSA Agent told the Engineer his answer was wrong

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

Sure, let me do a preorder traversal.

I have no clue what this means therefore I definitely belong here

...

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.

>He didn't know why manhole covers are round
>deport him

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

>muh thinkpad
>muh open sauce software

>barely better than a linked list.

>O(logn) is barely better than O(n) when searching

Have you tried turning it on and off again?

EZ