c***d 发帖数: 996 | 1 ☆─────────────────────────────────────☆
OverCloud (天马行空) 于 (Tue Jul 17 15:36:16 2007) 提到:
写了一个C++ template. 基本上是用的quick sort的方法,把数据作partition. 和
quick sort不同的是,不是全部partition, 只是一头做, 把数据往一头赶. 如果数据
是object, 可以用指针.
/***************************************************************************
**
* Find top elements.
*
* a data to find largest
* len length of a
* out buffer to take result. Should have length of at least of n
* n number of top elements to find
* |
|