It seems to run very fast, even for relatively large (size 10) sets. Can anyone tell me the big-theta runtime of their particular algorithm? I can’t find it in the documentation.
Share
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.
My first attempt at answering this was badly flawed. Since the most of the internal algorithms have no posted limiting behavior, I decide to measure this directly. I measured thetime it takes to calculate the
Permutationsof a random list of values, and calculated the average and standard deviation over a 1000 of them for each length. I used a maximum length of 10 elements due to time required, and thatPermutationsonly works lists up to length 12. My results on a log plot:The mean is the black line, and one standard deviation is represented by the filled region surrounding the mean. Starting at length 5, it is roughly straight until 10 where a slight curve can be detected. I’d suspect it is O(n!), but for lengths below 7 or 8, it really won’t matter. Even permutations of length 10 gave a respectable showing averaging at 0.241 +/- 0.012 s.