0, but you need it to get work. Just be pragmatic about it. The same way you've learned a lot of crap at school for nothing, do you expect that in the job market it would be any different? The world is fucked up, the earlier you internalise this in yourself, the less you suffer.
Ask HN: Have you ever needed to invert a binary tree at work?
11–20 of 22 posts
Re: Ask HN: Have you ever needed to invert a binary tree at work?
#12TBH asking that kind of question at interview is a big red flag for me, means that they don't understand how to interview tech people and therefore probably don't understand how to manage tech people.
Re: Ask HN: Have you ever needed to invert a binary tree at work?
#13What does that even mean? Putting it upside down? But that's just the exact same graph, so a no-op operation? Come to think of it, I wrote a plenty of no-op methods in my career...
Re: Ask HN: Have you ever needed to invert a binary tree at work?
#14I've used trees for data, but never had to invert one. TBH asking that kind of question at interview is a big red flag for me, means that they don't understand how to interview tech people and therefore probably don't understand how to manage tech people.
This means Google and others don't understand how to manage tech people... which I guess it may be true.
Re: Ask HN: Have you ever needed to invert a binary tree at work?
#15- implement my own binary tree
- implement my own "invert a binary tree" algorithm
Reasons:
- my own implementation would be way worse than any other open source implementation (which has been reviewed extensively) in terms of: performance, number of bugs, correctness
- it would be a hell to maintain for future developers that have to maintain my code
- it just makes sense. Well understood algorithms do not require re-implementation
Re: Ask HN: Have you ever needed to invert a binary tree at work?
#16I've used trees for data, but never had to invert one. TBH asking that kind of question at interview is a big red flag for me, means that they don't understand how to interview tech people and therefore probably don't understand how to manage tech people.
> TBH asking that kind of question at interview is a big red flag for me, means that they don't understand how to interview tech people and therefore probably don't understand how to manage tech people. This means Google and others don't understand how to manage tech people... which I guess it may be true.
Re: Ask HN: Have you ever needed to invert a binary tree at work?
#17So flipping the left and right, no I have never had to do that. I have had to write algorithms that processed the tree in infix, prefix and postfix order. And I have had to do it backwards, which is kind of the same but I never changed the tree for that.
As far as an interview question it is testing 2 things, 1) do you even know what a binary tree is, 2) are you comfortable with recursion. And in my case 3) are you willing to admit you do not understand and need an explanation.
From an interview perspective, all 3 are viable questions.
Re: Ask HN: Have you ever needed to invert a binary tree at work?
#18I've used trees for data, but never had to invert one. TBH asking that kind of question at interview is a big red flag for me, means that they don't understand how to interview tech people and therefore probably don't understand how to manage tech people.
> TBH asking that kind of question at interview is a big red flag for me, means that they don't understand how to interview tech people and therefore probably don't understand how to manage tech people. This means Google and others don't understand how to manage tech people... which I guess it may be true.
Re: Ask HN: Have you ever needed to invert a binary tree at work?
#19Re: Ask HN: Have you ever needed to invert a binary tree at work?
#20If you ever have to maintain a code base that happens to invert binary trees, find a way to nuke that code. Whatever needs the binary tree backwards should just process the original order backwards. Then you can say you once needed to remove a silly binary tree inversion at work.
Even reversing arrays and linked lists is suspicious.
Lisp code sometimes does a nreverse pass due to pushing items onto a stack while processing, which reverses their order.
I've never had to reverse an array in C or what have you.
I recall that the block sort algorithm does some clever things with multiple reverses of subranges of an array.