Concept

What are the advantages of using qsort() and related generic functions?

ComputerScienceOne / Sorting

"The advantages to using qsort() (as well as lfind() and bsearch()) should be clear. There is no need to write a new function that reimplements the same algorithm for every possible ordering of every possible user-defined structure. We need only to create a comparator function and pass it to qsort(). There is less code, and less chance of bugs. The qsort() function is well-designed, optimized, and most importantly well-tested and proven. These functions represent a sort of “weak” form of polymorphic behavior found in more modern object-oriented programming languages and other languages that support “generic programming.” Polymorphism is the characteristic that the same code can be executed on different types, greatly reducing the need for duplicate code.\n\nWe illustrate the usage of these functions in Code Samples 25.2 and"

Related Ideas

What are the advantages of using qsort() and related generic functions? | ComputerScienceOne | Bifalgorithm | Bifalgorithm