Chapter

Comparator Functions

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. What is a comparator function and how does it determine element order?

    "A generic Quick Sort algorithm specifies how to sort elements, but it doesn’t specify how they are ordered. Essentially, Quick Sort needs to know when two elements, a and b, are in order, out of orde

  2. How do you implement a comparator for integers in C?

    "To write a comparator function that orders integers in ascending order, the generic pointers must first be converted into pointers to the specific type being compared. In general, a void pointer cann

  3. How can comparator functions order Student structures?

    "A comparator function is designed with certain expectations, namely that a user will always pass it valid pointers to values of the expected type. If two double pointers are passed to cmpInt(), the c

Comparator Functions | ComputerScienceOne | Bifalgorithm | Bifalgorithm