I have a list of lists and I am sorting them using the following
data=sorted(data, key=itemgetter(0))
Was wondering what is the runtime complexity of this python function?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Provided
itemgetter(0)isO(1)when used withdata, the sort isO(n log n)both on average and in the worst case.For more information on the sorting method used in Python, see Wikipedia.