fixed a problem at HeapSort that the "number <=2" ????

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-02-03 17:43:57 +08:00
parent 39fbdef7a6
commit 0e31543779

View File

@ -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;