fixed a problem at HeapSort that the "number <=2" ????
This commit is contained in:
parent
39fbdef7a6
commit
0e31543779
@ -3,8 +3,7 @@
|
||||
|
||||
#include<hgl/TypeFunc.h>
|
||||
#include<string.h>
|
||||
namespace hgl
|
||||
{
|
||||
|
||||
template<typename T> class SortBase
|
||||
{
|
||||
protected:
|
||||
@ -69,6 +68,8 @@ namespace hgl
|
||||
virtual bool sort()=0; //排序
|
||||
};//struct SortBase
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
//堆排序
|
||||
template<typename T> class HeapSort:public SortBase<T>
|
||||
{
|
||||
@ -111,7 +112,7 @@ namespace hgl
|
||||
|
||||
bool sort()
|
||||
{
|
||||
if(!SortBase<T>::buffer||SortBase<T>::number<=2||!SortBase<T>::comp)
|
||||
if(!SortBase<T>::buffer||SortBase<T>::number<2||!SortBase<T>::comp)
|
||||
return(false);
|
||||
|
||||
int i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user