Problem 1056. Partial sorting algorithm
Solution Stats
Problem Comments
-
4 Comments
Argh! The 'mod sorting' has me flummoxed!
Is this broken? On my machine at least the anonymous comparison function is not found in profile('info').
Also, note that in the "mod comparison" case, the ordering has some unintuitive properties. For instance, 30 > 6 since 30 divides 6 and 30 ~ 20 since neither divides the other, but 20 ~ 6 for the same reason, meaning that ~ is not transitive using this comparison function.
A final issue: the comparison the "mod comparison" case does not match the description in the problem. The problem states that this function should return "true [if] element m should be ranked higher than element n" (m > n), but in this test case, the function also returns true when m is equal to n (and so implements m >= n).
Solution Comments
Show commentsProblem Recent Solvers9
Suggested Problems
-
Renaming a field in a structure array
1340 Solvers
-
All your base are belong to us
520 Solvers
-
177 Solvers
-
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
210 Solvers
-
Relative ratio of "1" in binary number
1067 Solvers
More from this Author5
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!