How do I implement a sorting algorithm for pairwise comparisons in a survey? | XM Community
Skip to main content
Hello, I'd like to use a sorting algorithm for pairwise comparisons of about 24 items in a survey. I think the Introsort algorithm would serve my purposes well. As far as I can tell, this could be set up as Javascript in a question, but I'm not familiar with Javascript and haven't used this sort of function in Qualtrics before. Does anyone have any advice? Thank you!
It isn't really clear to me exactly what you are trying to do, but with just 24 items to sort, the specific algorithm probably isn't important...the difference between algorithms will be unnoticeable. In JS you should probably just put the items in an array and use sort()").



As far as not being familiar with JS, you can either learn by doing or find someone to do it for you.
> @TomG said:

> It isn't really clear to me exactly what you are trying to do, but with just 24 items to sort, the specific algorithm probably isn't important...the difference between algorithms will be unnoticeable. In JS you should probably just put the items in an array and use sort()").

>

> As far as not being familiar with JS, you can either learn by doing or find someone to do it for you.



I'm back to trying to solve this after considering other options.



What I want to do is this:



I would like the participants to complete a series of pairwise comparisons indicating which quality they most prefer from the total array of qualities until a stable rank order of all 24 qualities is achieved. I think the Quick Sort algorithm would be fine. So the participant would see 2 qualities -- in this case, it's qualities of schools -- such as, 'high number of teachers with advanced degrees' and 'many extracurricular activities'. They pick which quality they most prefer and then the algorithm proceeds to display a subsequent pairwise comparison. The process iterates optimally until a (mostly) stable ranking is achieved. So each of the 24 qualities could be assigned a number (1-24).



Still not sure how to make this work, but willing to either learn or find someone! Thanks!

Leave a Reply