Design patterns for sorting
暂无分享,去创建一个
Drawing on Merritt's divide-and-conquer sorting taxonomy [1], we model comparison-based sorting as an abstract class with a template method to perform the sort by relegating the splitting and joining of arrays to its concrete subclasses. Comparison on objects is carried out via an abstract ordering strategy. This reduces code complexity and simplifies the analyses of the various concrete sorting algorithms. Performance measurements and visualizations can be added without modifying any code by utilizing the decorator design pattern. This object-oriented design not only provides the student a concrete way of unifying seemingly disparate sorting algorithms but also help him/her differentiate them at the proper level of abstraction.
[1] Ralph Johnson,et al. design patterns elements of reusable object oriented software , 2019 .
[2] Susan M. Merritt,et al. An inverted taxonomy of sorting algorithms , 1985, CACM.