mardi 21 juillet 2020

Software testing: how would a partially ordered array cause a sorting algorithm to fail?

I was asked to come up with test cases for a method that sorts an array of integer values.

Researching test ideas, I came across this blog post that says:

"Some broken sorts will appear to do the right thing if the elements are already in order — for example, the O(1) sort consisting of no statements at all will do this. Others, more rarely, might stumble on the right answer if the input is sorted in reverse. Yet others will be caught out by cases in which some of the elements are already in order and others are not."

https://reprog.wordpress.com/2010/05/20/what-does-it-take-to-test-a-sorting-routine/

What would have to be de definition of a partially sorted array for it to cause a sort algorithm to fail?

Could you show me some examples of algorithms that would fail on a partially sorted array?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire