Question: Which language is the example implementation written in?
The example is written in Python.
I'm planning on simplifying it a bit, in particular to remove the cmp function being passed as a parameter:
- A built-in function cmp() already exists, and means something different (-ve if a<b, 0 if a=b, +ve if a>b);
- IMO, Python's lambda notation and default arguments are not appropriate for near pseudo-code;
- "a > b" is much better for trying to understand an algorithm than a function call.
- Custom Python types can define their own comparisons anyway, so a comparator parameter is unnecessary.
--Carey Evans