CUJ:标准库:标准库中的排序算法[9]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 taodm 的 blog

  qsort(a, v.size(), sizeof(double), &dcompare);

  double elapsed = t.time();

  delete[] a;

  return std::make_pair(string("qsort"), elapsed);

}

 

 

template <class container>

pair<string, double>

do_stable_sort(container c)

{

  timer t;

  std::stable_sort(c.begin(), c.end());

  return std::make_pair(string("stable_sort"), t.time());

}

 

template <class container>

pair<string, double>

do_heap_sort(container c)

{

  timer t;

  std::make_heap(c.begin(), c.end());

  std::sort_heap(c.begin(), c.end());

  return std::make_pair(string("heap sort"), t.time());

}

 

template <class container>

pair<string, double>

do_list_sort(container c)

本文关键:CUJ、STL、排序、Matthew Austern
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top