i heard one of the method is using % and / as predicate when compare the elements, but i dont really understand why use % and /, may anyone explan for me, thx very much!
This is a discussion on how do u test sorting algorithm stability within the C++ Programming forums, part of the General Programming Boards category; i heard one of the method is using % and / as predicate when compare the elements, but i dont ...
i heard one of the method is using % and / as predicate when compare the elements, but i dont really understand why use % and /, may anyone explan for me, thx very much!
1) Take a piece of data.
2) Take a less-than operator that does not use the entire piece of data in comparing.
3) Sort using that less-than operator, with some of the data comparing as equal while containing different parts.
4) Check to see if 'equal' elements' order is preserved.
For example, have your data be strings, and then sort by the lengths of the strings.