Hi all,
When an interviewer ask me in an interview "given an array, write a sorting algorithm for sorting this array", what is he looking for to see ?
Is he looking for the most efficient algorithm ? Is he asking that to see if I'm familiar with some kind (doesn't matter what) of sorting algorithm ? Is he checking my programming write skills ?
I'm asking that cause I know how to implement and to write the in-place bubblesort algorigthm (it's not so difficult to write), but at the other hand it's not that efficient (O(n^2)). I also know how to implement the counting sort (sometimes it's also called 'bucket sort') but it's too also not that efficient (O(n)).
I am familiar with some other efficient algorithms like quicksort (most of the cases O(nlogn), depends on the pivot choosing) and merge sort (O(nlogn)) but it's not that easy to implement them and for the first one , in most cases you use the directory function for that.
I would be glad to hear your point of view if you are also interviewers and also if not....
thanks!
When an interviewer ask me in an interview "given an array, write a sorting algorithm for sorting this array", what is he looking for to see ?
Is he looking for the most efficient algorithm ? Is he asking that to see if I'm familiar with some kind (doesn't matter what) of sorting algorithm ? Is he checking my programming write skills ?
I'm asking that cause I know how to implement and to write the in-place bubblesort algorigthm (it's not so difficult to write), but at the other hand it's not that efficient (O(n^2)). I also know how to implement the counting sort (sometimes it's also called 'bucket sort') but it's too also not that efficient (O(n)).
I am familiar with some other efficient algorithms like quicksort (most of the cases O(nlogn), depends on the pivot choosing) and merge sort (O(nlogn)) but it's not that easy to implement them and for the first one , in most cases you use the directory function for that.
I would be glad to hear your point of view if you are also interviewers and also if not....
thanks!