Meta interview question

Given array of elements of 3 types. Sort it.

Interview Answers

Anonymous

27 June 2012

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

1

Anonymous

26 June 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

13 Feb 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

13 June 2012

Use counting sort for example.

Anonymous

24 Aug 2012

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