📄 heapsort.cpp
字号:
// HeapSort.cpp: implementation of the CHeapSort class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "sort.h"
#include "HeapSort.h"
#include "maxheap.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CHeapSort::CHeapSort()
{
name=_TEXT("堆");
}
CHeapSort::~CHeapSort()
{
}
void CHeapSort::Sort()
{
CMaxHeap heap(p,n,this);
for (int i=0;i<n;i++)
if (heap.removemax()==-2) {State2=1;return;};
State2=2;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -