适配器
姓名:何桥 学号:201130690105
UML设计图
一、类适配器
二、对象适配器
interface SortInfo//接口声明所有需要的方法
{
int[] sort(int[] s);
}
二、快速排序类的实现
class QuickSort//实现快速排序类
{
public QuickSort()//无参构造{ }
public int[] quickSort(int[] s)
{ return quickSort(s,0,s.Length-1);//递归调用}
int[] quickSort(int[] s, int low, int high)
{ if (low < high)
{ int key = s[low];
int left = low;
int right = high;
while (left < right)
{
while (left < right && s[right] >= key)
{ right--; }
s[left] = s[right];
&nb