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

>tfw asked to implement a BST during interview

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: 16
Thread images: 1

File: images (6).jpg (7KB, 218x218px) Image search: [Google]
images (6).jpg
7KB, 218x218px
>tfw asked to implement a BST during interview
>>
>tfw asked to implement a BST in an AST
>>
>>60902561
dumb frogposter
>>
>>60902561
if you've done that before or even just understood the concept at least once in your life it shouldn't be that hard...
>>
What the hell is BST and AST
>>
>>60902693
binary search tree and abstract syntax tree
>>
weird bait thread you have here
>>
Now thats actually not that hard. If smaller make left child else make right child.
>>
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None

def bst(self, data):
if self.data == data:
return True
elif self.left is not None and self.data > data:
return self.left.bst(data)
elif self.right is not None and self.data < data:
return self.right.bst(data)
else
return False


how would BST in AST work?
>>
>>60902825

i prefer the array representation. objects & recursion is probably the most concise but can become a mess of pointers and suffer from caching issues if sufficiently large desu
>>
>>60902989
k
int bst(int *bt, size_t len, int data)
{
size_t i = 0;
while (i < len && vec[i] != data) {
if (vec[i] < data)
i = 2*i + 1;
else
i = 2*i + 2;
}
return i < len;
}
>>
>>60902989
Be real for one second anon. In real life you download library.

This is just shit test to see how big failure you are during interview. And if you can work under stress.
>>
>>60903098
>Being a Library babby
>>
>>60903127
Not googling problems and finding solved solutions implemented and tested to perfection before implementing it yourself.

It is almost like you want to waste time and money on purpouse.

Arent you that one guy who implements his own sql connectors and data parsers himself?
>>
>>60903127
>insisting on reinveting the wheel and wasting time on problem someone already solved
>>
>>60903098

In real life I'd check the language's standard library to see if it's builtin, yeah. these sorts of things are bullshit to test on given what coding is like in real life but it's a good filter, even if it mostly tests "did this guy go to school and do an algos class" it still keeps idiots out
Thread posts: 16
Thread images: 1


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