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<hgl/TypeFunc.h>
|
||||||
#include<string.h>
|
#include<string.h>
|
||||||
namespace hgl
|
|
||||||
{
|
|
||||||
template<typename T> class SortBase
|
template<typename T> class SortBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -69,6 +68,8 @@ namespace hgl
|
|||||||
virtual bool sort()=0; //排序
|
virtual bool sort()=0; //排序
|
||||||
};//struct SortBase
|
};//struct SortBase
|
||||||
|
|
||||||
|
namespace hgl
|
||||||
|
{
|
||||||
//堆排序
|
//堆排序
|
||||||
template<typename T> class HeapSort:public SortBase<T>
|
template<typename T> class HeapSort:public SortBase<T>
|
||||||
{
|
{
|
||||||
@ -111,7 +112,7 @@ namespace hgl
|
|||||||
|
|
||||||
bool sort()
|
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);
|
return(false);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user