Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
Lab028
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
DS Lab Group
实验项目模板
Lab028
提交
f45de6e9
提交
f45de6e9
5月 20, 2019
创建
作者:
宋海霞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify
上级
58ce1188
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
19 行增加
和
19 行删除
+19
-19
main.c
main.c
+19
-19
没有找到文件。
main.c
浏览文件 @
f45de6e9
...
...
@@ -7,10 +7,10 @@ int main(int argc, char* argv[])
SortObject
List
;
//
//
初始化线性表
//
Initialize the linear table
//
int
InitList
[]
=
{
26
,
5
,
77
,
1
,
61
,
11
,
59
,
15
,
48
,
19
};
int
n
=
sizeof
(
InitList
)
/
sizeof
(
InitList
[
0
]);
//
计算线性表长度
int
n
=
sizeof
(
InitList
)
/
sizeof
(
InitList
[
0
]);
//
Calculate the linear table length
List
.
Elements
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
n
);
List
.
length
=
n
;
for
(
i
=
0
;
i
<
List
.
length
;
i
++
)
...
...
@@ -32,45 +32,45 @@ int main(int argc, char* argv[])
}
/*
功能:
由下向上把各层子树调整成为大根堆
。
function:
由下向上把各层子树调整成为大根堆
.
参数:
List --
线性表指针
size --
线性表中用于构造大根堆的元素的个数
i -- 指定开始构造大根堆的元素的起始位置
。从 0 开始计数。
parameter:
List --
Linear table pointer
size --
The number of elements in the linear table used to construct the large root heap
i -- 指定开始构造大根堆的元素的起始位置
.从 0 开始计数.
返回值:
returned value:
空
*/
void
Sift
(
SortObject
*
List
,
int
size
,
int
i
)
{
//
// TODO:
在此添加代码
// TODO:
Add the code here
//
return
;
}
/*
功能:
堆排序
。
function:
堆排序
.
参数:
List --
线性表指针
parameter:
List --
Linear table pointer
返回值:
returned value:
空
*/
void
HeapSort
(
SortObject
*
List
)
{
int
i
=
0
;
//
游标
int
size
=
List
->
length
;
//
线性表中元素的个数
int
HeapSize
=
0
;
//
线性表中用于构造大根堆的元素的个数
int
i
=
0
;
//
The cursor
int
size
=
List
->
length
;
//
The number of elements in a linear table
int
HeapSize
=
0
;
//
The number of elements in the linear table used to construct the large root heap
//
// TODO:
在此添加代码
// TODO:
Add the code here
//
return
;
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论