Frage im Vorstellungsgespräch bei Salesforce

How to sort an array?

Antworten zu Vorstellungsgespräch

Anonym

22. Dez. 2015

Divide-and-conquer. Need to mention average time complexity (O(nlog(n)) and space complexity (constant). Worse case can be O(n^2) if the array is already sorted. Shuffling is usually done in production quick sort.

Anonym

23. Dez. 2015

Seems like interviewer here is not looking for one approach but understanding of when to use which algorithm. Like bubble sort is good for a very small n. or insertion sort when most of elements are sorted. etc.