Meta Interview Question

Given array of elements of 3 types. Sort it.

Interview Answers

Anonymous

Jun 27, 2012

Here, you can assume objects are small, middle and large for example.

1

Anonymous

Jun 26, 2012

The question is plain wrong and i think is a trick question. You cannot have an array of 3 different types. Array can only be of a single type. If for some weird reason the interviewer asks you to assume such an array exists, then the first thing needed is Comparison routine or criteria i.e. rules to compare two elements to determine if one is smaller or larger

1

Anonymous

Feb 13, 2013

Interviewee wanted to here solution to Dutch National Flag problem. See http://en.wikipedia.org/wiki/Dutch_national_flag_problem I didn't know about it at that time.

Anonymous

Jun 13, 2012

Use counting sort for example.

Anonymous

Aug 24, 2012

There is a clever O(n) in-place sorting algorithm for this.