3 ms·
I'm somewhat baffled by the reversing a binary tree thing in the article and in the comments here. Unless you don't know what a binary tree is, or are forbidde
by tzs 6y ago
I'm somewhat baffled by the reversing a binary tree thing in the article and in the comments here.
Unless you don't know what a binary tree is, or are forbidden to use recursion, you should be able to figure it out even if you have never studied algorithms. This is FizzBuzz level stuff.
The only difficulty should be if representing a binary tree in the language you are using involves pointers/references or nesting that you do not understand. In that case, the question has exposed a serious gap in your knowledge of that language which you really should fix. It's OK to not know the more esoteric features of a language, but you should know how it handles pointers/references or nested data structures.
- jdeaton 6y agoTo spell it out... "reversing a binary tree" here is just being used as a stand-in reference for any CS-y interview question that is neither relevant to the job, nor particularly difficult to solve but would be much more familiar territory for anyone who has taken traditional CS courses. The fact that reversing a binary tree is in fact trivial is to help make the point that these kinds of questions are not that useful.
- reedf1 6y agoExactly this - as someone with a non-traditional background (physics) "reversing a binary tree" is as you say completely trivial and I could have "discovered" the answer to the question in slightly slower than real-time in an interview. But people with CS backgrounds don't need to discover it, they have it memorised. These questions aren't testing for original thought or problem-solving ability, they are testing for your skill at memorisation or, to put it more cheekily, regurgitation. I've worked in the industry for years now and I've probably used more maths from my physics degree than I have of the algorithms that I learn for interview.