Gainsight interview question

Quick sort code and questions about time complexity