Whiteboard coding in software developer interviews.

cguy

Executive Member
Joined
Jan 2, 2013
Messages
8,527
The anecdotes above aren't just "stuff I've seen as some guy somewhere", I was a Silicon Valley manager in a large company, where we would keep track of these things, so this actually adds up to a lot of samples.

[)roi(];17552694 said:
WTF You didn't share any of this. Still I have my doubts of any validity, "our engineesr" WTFs up with that, thought you were into research? Are you now a recruitment agency?

sigh... yes, recruitment companies employ engineers...
 

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
sigh... yes, recruitment companies employ engineers...
Lol... <update>guess I missed that; still sounds like an opinion. If the data was at all credible, we would have had tons of articles on this already.
Apple topics are always newsworthy; journalists and economists would have jumped at the smallest rumour; hence IMO your credibility is doubtful, unless of course you're going to point me to all those rumour mill articles I overlooked. :wtf: :whistling:
 
Last edited:

cguy

Executive Member
Joined
Jan 2, 2013
Messages
8,527
[)roi(];17554220 said:
Lol... <update>guess I missed that; still sounds like an opinion. If the data was at all credible, we would have had tons of articles on this already.
Apple topics are always newsworthy; journalists and economists would have jumped at the smallest rumour; hence IMO your credibility is doubtful, unless of course you're going to point me to all those rumour mill articles I overlooked. :wtf: :whistling:

I have given the market motivation for why this is the way it is, and pointed out that this is corroborated by my experiences as someone who has worked in senior positions as an individual contributor and manager (with information on employee flow) in a large Silicon Valley tech company for the better part of a decade. Data isn't an opinion and neither are market forces - obviously you can choose not to believe me, I don't really care - I don't think you're good enough material for either firm anyway.

As for why there aren't news articles about this - it's because this isn't news - everybody knows this already. Maybe BusinessTech can do an article on it for you? :p
 

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
I have given the market motivation for why this is the way it is, and pointed out that this is corroborated by my experiences as someone who has worked in senior positions as an individual contributor and manager (with information on employee flow) in a large Silicon Valley tech company for the better part of a decade. Data isn't an opinion and neither are market forces - obviously you can choose not to believe me, I don't really care - I don't think you're good enough material for either firm anyway.

As for why there aren't news articles about this - it's because this isn't news - everybody knows this already. Maybe BusinessTech can do an article on it for you? :p
Yeah yeah starting to realize you're a know it all (sadly missing public accessible proof)
US & others: been there, done it; 20 years as an expat was more than enough.
Ps. Remember what's said about getting personal
 
Last edited:

cguy

Executive Member
Joined
Jan 2, 2013
Messages
8,527
[)roi(];17556046 said:
Yeah yeah starting to realize you're a know it all (sadly missing public accessible proof)
US & others: been there, done it; 20 years as an expat was more than enough.
Ps. Remember what's said about getting personal

Dude, if you had "been there and done that", you wouldn't be bemoaning your inability to travel because of the Rand on your profile.
 

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
I looked up the problem statement for "inverting a binary tree" - it seems as though this means: reflect the tree such that it is the mirror image (i.e., for each level the nodes read left to right should read right to left). If this is indeed the problem statement (and please, correct me if I'm wrong!), and someone got this wrong or regards this as special knowledge/"a trick", especially during an interactive interview, I would also disqualify them - it shows a total inability to think about algorithms.
This statement bugged me a little, primarily because it sounded far too easy. Would a seasoned programmer really struggle to swap left/right node values; doubtful, hence I filed it away as something that needed clarification. First thought I'd have to PM Max to ask for clarification, but apparently it was easier than that: it has already been asked and answered.

Let's summarize
Many assumed incorrectly that it implied swapping the left/right nodes (i.e. a simplistic horizontal flip of a binary tree) -- an action with no obvious practical application, yet others assumed it was to vertically flip the tree; again impractical as that is only a representational output difference, again no obvious practical use.

So the question is what was actually expected? Max provided the following clarification On Twitter:
image.jpg
...or more specifically, the problem was to demonstrate how to turn a binary tree into a min-max binary tree, otherwise known as a double ended priority queue. Min-max ordered binary trees are used to expedite the process to find both the largest and the smallest elements of a binary tree in a predictable timeframe (constant); as opposed to reordering at a cost of a full sort (n log n) or worst case (n^2). Similarly time penalities are reduced when deleting or inserting nodes as it again doesn't required an expensive sort, but the ordering stays localised to only the relevant even (odd) neighbors.

Detail explanation
A binary tree is consider min-max ordered once every element on even (odd) levels is less (or greater) than all children and grand children. Here's two examples of a min-max ordered binary tree:
Min-max_heap.jpg
image.jpg
The implementation will typically require the following methods:
  • insert / delete node with localised reordering
  • Localised sorting using: bubble up, sink down and swap
  • Custom min / max that iterates between even / odd levels to find answers

Reference: http://cglab.ca/~morin/teaching/5408/refs/minmax.pdf
 
Last edited:

cguy

Executive Member
Joined
Jan 2, 2013
Messages
8,527
[)roi(];17561276 said:
This statement bugged me a little, primarily because it sounded far too easy. Would a seasoned programmer really struggle to swap left/right node values; doubtful, hence I filed it away as something that needed clarification. First thought I'd have to PM Max to ask for clarification, but apparently it was easier than that: it has already been asked and answered.

Let's summarize
Many assumed incorrectly that it implied swapping the left/right nodes (i.e. a simplistic horizontal flip of a binary tree) -- an action with no obvious practical application, yet others assumed it was to vertically flip the tree; again impractical as that is only a representational output difference, again no obvious practical use.

So the question is what was actually expected? Max provided the following clarification On Twitter:
View attachment 360700
...or more specifically, the problem was to demonstrate how to turn a binary tree into a min-max binary tree, otherwise known as a double ended priority queue. Min-max ordered binary trees are used to expedite the process to find both the largest and the smallest elements of a binary tree in a predictable timeframe (constant); as opposed to reordering at a cost of a full sort (n log n) or worst case (n^2). Similarly time penalities are reduced when deleting or inserting nodes as it again doesn't required an expensive sort, but the ordering stays localised to only the relevant even (odd) neighbors.

Detail explanation
A binary tree is consider min-max ordered once every element on even (odd) levels is less (or greater) than all children and grand children. Here's two examples of a min-max ordered binary tree:
View attachment 360708
View attachment 360758
The implementation will typically require the following methods:
  • insert / delete node with localised reordering
  • Localised sorting using: bubble up, sink down and swap
  • Custom min / max that iterates between even / odd levels to find answers

Reference: http://cglab.ca/~morin/teaching/5408/refs/minmax.pdf

That is definitely a harder question - still pretty run of the mill for a good CS guy once the data structure is explained though. It is certainly not something I would expect anyone to just know (I had to look up what a min-max heap was myself), but the creation/insertion algorithm follows from this quite easily. This leaves two minor mysteries: why on earth would he call this "inverting" a tree? Also, now it is even less clear why he would be booted for this. I don't believe that any interviewer would terminate an interview because a candidate couldn't get this question in a vacuum - it is far more likely he did or said something unacceptable, or refused to participate in working through creating a solution with the interviewer.

BTW, this bit is very bizarre "; as opposed to reordering at a cost of a full sort (n log n) or worst case (n^2)", since you never need more than O(n) time to find the min and/or max of any array. Also, there are sorts with worst case O(n logn) - if I was talking about the general complexity of sorts, I wouldn't use a quick-sort (or variation thereof).
 
Last edited:

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
That is definitely a harder question - still pretty run of the mill for a good CS guy once the data structure is explained though. It is certainly not something I would expect anyone to just know (I had to look up what a min-max heap was myself), but the creation/insertion algorithm follows from this quite easily. This leaves two minor mysteries: why on earth would he call this "inverting" a tree? Also, now it is even less clear why he would be booted for this. I don't believe that any interviewer would terminate an interview because a candidate couldn't get this question in a vacuum - it is far more likely he did or said something unacceptable, or refused to participate in working through creating a solution with the interviewer.

BTW, this bit is very bizarre "; as opposed to reordering at a cost of a full sort (n log n) or worst case (n^2)", since you never need more than O(n) time to find the min and/or max of any array. Also, there are sorts with worst case O(n logn) - if I was talking about the general complexity of sorts, I wouldn't use a quick-sort (or variation thereof).
Agreed re the confusion of his first tweet about inverting a binary tree as opposed to just saying it was minmax.
As to how much detail about the algorithm was provided prior to the WB attempt, we can only guess, but like you this concept was unfamiliar, but with a good explaination the methods should be fairly easy to work out (still not sold on the need to do this on the WB though)

Finally as to the algorithm time constant vs alternatives; the approach needs to probably be examined on the whole: average time cost for inserts, deletions and searches, which all work naturally on the principle of minimizing the number of operations. As to comparative approaches including sorting and search algorithms, we shouldn't forget we aren't dealing with a typical linear array structure, so performing a sort or search has the added complexity of that. Plus we probably need to consider what search algorithms we would typically employ to reduce unnecessary overhead; a standard binary search as you know requires a sorted structure, whereas it's easy to see how minmax's odd/even design easily could facilitate fast search with threading without the need for a full sort (comparison drawn against binary search).
 
Last edited:

Hackson

Senior Member
Joined
May 9, 2010
Messages
690
Please interview me. I need less resources though. Just sublime and a Java compiler together with whatever framework tickles your fantasy. I'm good with communication as well. I means sure I have forgotten how to bubble sort and how to go from O(n^3) to O(n).
 

cguy

Executive Member
Joined
Jan 2, 2013
Messages
8,527
[)roi(];17564300 said:
Agreed re the confusion of his first tweet about inverting a binary tree as opposed to just saying it was minmax.
As to how much detail about the algorithm was provided prior to the WB attempt, we can only guess, but like you this concept was unfamiliar, but with a good explaination the methods should be fairly easy to work out (still not sold on the need to do this on the WB though)

Finally as to the algorithm time constant vs alternatives; the approach needs to probably be examined on the whole: average time cost for inserts, deletions and searches, which all work naturally on the principle of minimizing the number of operations. As to comparative approaches including sorting and search algorithms, we shouldn't forget we aren't dealing with a typical linear array structure, so performing a sort or search has the added complexity of that. Plus we probably need to consider what search algorithms we would typically employ to reduce unnecessary overhead; a standard binary search as you know requires a sorted structure, whereas it's easy to see how minmax's odd/even design easily could facilitate fast search with threading without the need for a full sort (comparison drawn against binary search).

A minmax heap has it's advantages of course, however, doing better than O(nlogn) to find the min and max is nothing special (which is why it is bizarre that he mentions it). The benefit it has is that it can do it in O(1) time, vs O(logn) on a balanced and sorted structure or O(n) on an unsorted or unbalanced structure. All that an unsorted structure needs to support this in O(n) is O(n) traversal, which is available on everything from linear arrays (which a minmax heap is usually built on), trees, graphs, lists or (de)queues, etc. the reason for this is that a sort isn't actually necessary at all.

Edit: it's a little like saying that the benefit of cycling is that it's faster than hopping on one leg. ;)
 
Last edited:

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
A minmax heap has it's advantages of course, however, doing better than O(nlogn) to find the min and max is nothing special (which is why it is bizarre that he mentions it). The benefit it has is that it can do it in O(1) time, vs O(logn) on a balanced and sorted structure or O(n) on an unsorted or unbalanced structure. All that an unsorted structure needs to support this in O(n) is O(n) traversal, which is available on everything from linear arrays (which a minmax heap is usually built on), trees, graphs, lists or (de)queues, etc. the reason for this is that a sort isn't actually necessary at all.

Edit: it's a little like saying that the benefit of cycling is that it's faster than hopping on one leg. ;)
Yeah sure. but not all BTs are easy adapted to linear arrays without an overhead (e.g. syntax trees); so advantage is really going depend on the application, but yes where feasible balanced trees will certainly be faster for searching e.g. good for indexing, cryptographic hashing, ...
 

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
Anyway I decided to work on another article for the Swift thread; care to take bets about the theme...

Ps. At this stage it's focusing primarily on two Swift approaches to the problem -- 1 using a reference (mutable) type: OOP class, and another 1 using a value (immutable) type: FP style enum. If that doesn't end up being to unwieldy (code length & explanation), I may even consider including a practical use of it.

Dynamic representation of abstract structures can be a challenge:
Screen Shot 2016-05-09 at 6.24.26 PM.png
But I think I finally figured out a good compromise (ps. turn your laptop 90 degrees to the right)
Screen Shot 2016-05-09 at 5.25.56 PM.png
 
Last edited:

freddster

Expert Member
Joined
Dec 13, 2013
Messages
2,470
Please interview me. I need less resources though. Just sublime and a Java compiler together with whatever framework tickles your fantasy. I'm good with communication as well. I means sure I have forgotten how to bubble sort and how to go from O(n^3) to O(n).
good heavens LOL... thats something I haven't heard of in years, 20 odd
 

GooMaty

Member
Joined
Dec 1, 2015
Messages
10
I learned to code on A4 excersize book, no access to internet or tablet nor computer. writting a bug was not an ''option''.
Whiteboard is good!
Think of dynamic programming, algorithms design.
It could be the type of assessment that is problematic either way programming is fun anywhere.
 
Joined
Sep 1, 2016
Messages
2,196
MTN used to do whiteboard interviews too... I failed one long ago, rather glad I did, who would want to work for a company like that.
 

cguy

Executive Member
Joined
Jan 2, 2013
Messages
8,527
Programmers are confessing their coding sins to protest a broken job interview process

https://theoutline.com/post/1166/pr...ins-to-protest-a-broken-job-interview-process

Hi, my name is Cguy. I've been giving and receiving whiteboard interviews for nearly 20 years now, and have never asked anything that requires rote learned algorithms, nor have I ever been asked to give a rote learned algorithm. I also understand that there is a marked difference between white-board-interviewing/algorithm-questions and regurgitating algorithms. I also realize that a large part of the interview is to see how the candidate and interviewer interact, something that can't be replicated with a take-home or on-computer test. I acknowledge that if Google and Amazon were really selecting for people who can rote learn well, versus actually thinking and problem solving, they wouldn't be among the top tech companies in the world. I also acknowledge that thinking that it is tough to find a new job because large chunks the industry are really doing something as idiotic as expecting a bunch of rote memorization, is a form of preferential reality distortion.
 

semaphore

Honorary Master
Joined
Nov 13, 2007
Messages
15,194
Hi, my name is Cguy. I've been giving and receiving whiteboard interviews for nearly 20 years now, and have never asked anything that requires rote learned algorithms, nor have I ever been asked to give a rote learned algorithm. I also understand that there is a marked difference between white-board-interviewing/algorithm-questions and regurgitating algorithms. I also realize that a large part of the interview is to see how the candidate and interviewer interact, something that can't be replicated with a take-home or on-computer test. I acknowledge that if Google and Amazon were really selecting for people who can rote learn well, versus actually thinking and problem solving, they wouldn't be among the top tech companies in the world. I also acknowledge that thinking that it is tough to find a new job because large chunks the industry are really doing something as idiotic as expecting a bunch of rote memorization, is a form of preferential reality distortion.

Shurrup what do you know anways, why don't you go do some functional programming. :crylaugh:
 

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
Programmers are confessing their coding sins to protest a broken job interview process

https://theoutline.com/post/1166/pr...ins-to-protest-a-broken-job-interview-process
Yeah I had my twitter timeline full of this for the last week or so... but considering I started a few of these threads I decided to skip out on starting another. Still glad to see there are many, who like me see the idiocy in the WB interview approach. Also great to see Foursquare's different approach; certainly far less prone to egos.
 
Last edited:
Top