mirror of
https://github.com/kangjianwei/Data-Structure.git
synced 2026-02-06 16:31:59 +08:00
♻️ 更新习题2.27的注释和一些非核心代码,顺便将CFree的代码更新为与其他分支一致
This commit is contained in:
@@ -1,117 +1,103 @@
|
||||
#include <stdio.h>
|
||||
#include "../../../▲课本算法实现/▲02 线性表/01 SequenceList/SequenceList.c" //**▲02 线性表**//
|
||||
|
||||
/* 函数原型 */
|
||||
void Algo_2_27__1(SqList La, SqList Lb, SqList *Lc);
|
||||
void Algo_2_27__2(SqList *La, SqList Lb);
|
||||
void PrintElem(LElemType_Sq e); //测试函数,打印整型
|
||||
/*
|
||||
* 题2.27
|
||||
*
|
||||
* 求交集:C=A∩B。
|
||||
*
|
||||
* A和B中元素可能重复,但C中元素不重复。
|
||||
* 而且,要求C利用A原有的空间。
|
||||
*/
|
||||
Status Algo_2_27(SqList La, SqList Lb, SqList* Lc);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SqList La, Lb, Lc_1, *Lc_2;
|
||||
int i;
|
||||
int a[10] = {1,2,2,3,4,5,6,7,7,8};
|
||||
int b[10] = {2,2,3,4,4,6,7,8,8,9};
|
||||
|
||||
if(InitList_Sq(&La) && InitList_Sq(&Lb)) //链表L创建成功
|
||||
{
|
||||
for(i=1; i<=10; i++)
|
||||
{
|
||||
ListInsert_Sq(&La, i, a[i-1]);
|
||||
ListInsert_Sq(&Lb, i, b[i-1]);
|
||||
}
|
||||
}
|
||||
|
||||
printf("La = ");
|
||||
ListTraverse_Sq(La, PrintElem);
|
||||
printf("\n");
|
||||
printf("Lb = ");
|
||||
ListTraverse_Sq(Lb, PrintElem);
|
||||
printf("\n\n");
|
||||
|
||||
printf("题 2.27 第(1)问验证:\n");
|
||||
InitList_Sq(&Lc_1);
|
||||
Algo_2_27__1(La, Lb, &Lc_1);
|
||||
printf("Lc = La∩Lb = ");
|
||||
ListTraverse_Sq(Lc_1, PrintElem); //输出L
|
||||
printf("\n\n");
|
||||
// 测试函数,打印元素
|
||||
void PrintElem(LElemType_Sq e);
|
||||
|
||||
printf("题 2.27 第(2)问验证:\n");
|
||||
Algo_2_27__2(&La, Lb);
|
||||
Lc_2 = &La;
|
||||
printf("Lc = La∩Lb = ");
|
||||
ListTraverse_Sq(*Lc_2, PrintElem); //输出L
|
||||
printf("\n\n");
|
||||
|
||||
return 0;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
SqList La, Lb, Lc;
|
||||
int i;
|
||||
|
||||
// 0号单元存储的是数组长度
|
||||
int a[] = {10, 1, 3, 3, 7, 9, 10, 13, 15, 15, 19};
|
||||
int b[] = {8, 1, 3, 7, 7, 10, 18, 18, 20};
|
||||
|
||||
// 准备测试数据,同一表中的元素值可能相同
|
||||
InitList_Sq(&La);
|
||||
InitList_Sq(&Lb);
|
||||
for(i = 1; i <= a[0]; i++) {
|
||||
ListInsert_Sq(&La, i, a[i]);
|
||||
}
|
||||
for(i = 1; i <= b[0]; i++) {
|
||||
ListInsert_Sq(&Lb, i, b[i]);
|
||||
}
|
||||
printf("La = ");
|
||||
ListTraverse_Sq(La, PrintElem);
|
||||
printf("\n");
|
||||
printf("Lb = ");
|
||||
ListTraverse_Sq(Lb, PrintElem);
|
||||
printf("\n");
|
||||
|
||||
// 求交集,新链表的元素各不相同
|
||||
Algo_2_27(La, Lb, &Lc);
|
||||
|
||||
printf("Lc = ");
|
||||
ListTraverse_Sq(Lc, PrintElem);
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*━━━━━━━┓
|
||||
┃题2.27:C=A∩B┃
|
||||
┗━━━━━━━*/
|
||||
/* (1) */
|
||||
void Algo_2_27__1(SqList La, SqList Lb, SqList *Lc)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
i = j = 0;
|
||||
k = 1;
|
||||
|
||||
while(i<La.length && j<Lb.length)
|
||||
{
|
||||
if(La.elem[i]<Lb.elem[j])
|
||||
i++;
|
||||
else if(La.elem[i]>Lb.elem[j])
|
||||
j++;
|
||||
else
|
||||
{
|
||||
if(!i || La.elem[i]!=La.elem[i-1])
|
||||
{
|
||||
ListInsert_Sq(Lc, k, La.elem[i]);
|
||||
k++;
|
||||
}
|
||||
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 题2.27
|
||||
*
|
||||
* 求交集:C=A∩B。
|
||||
*
|
||||
* A和B中元素可能重复,但C中元素不重复。
|
||||
* 而且,要求C利用A原有的空间。
|
||||
*/
|
||||
Status Algo_2_27(SqList La, SqList Lb, SqList* Lc) {
|
||||
int i, j, k;
|
||||
|
||||
// 确保La和Lb存在
|
||||
if(La.elem == NULL || Lb.elem == NULL) {
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
// 初始化Lc,使其直接使用La的存储空间
|
||||
*Lc = La;
|
||||
|
||||
i = j = 0; // 遍历La和Lb
|
||||
k = 0; // 遍历Lc
|
||||
|
||||
// 只遍历La和Lb的共同部分就行
|
||||
while(i < La.length && j < Lb.length) {
|
||||
if(La.elem[i] < Lb.elem[j]) {
|
||||
i++;
|
||||
} else if(La.elem[i] > Lb.elem[j]) {
|
||||
j++;
|
||||
|
||||
// 如果La和Lb中的元素相等
|
||||
} else {
|
||||
// 如果Lc不为空,则需要保证其中的元素不重复
|
||||
if(k == 0 || (*Lc).elem[k - 1] != La.elem[i]) {
|
||||
(*Lc).elem[k] = La.elem[i];
|
||||
k++;
|
||||
}
|
||||
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
// 更新顺序表Lc的长度
|
||||
(*Lc).length = k;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*━━━━━━━┓
|
||||
┃题2.27:C=A∩B┃
|
||||
┗━━━━━━━*/
|
||||
/* (2) */
|
||||
void Algo_2_27__2(SqList *La, SqList Lb)
|
||||
{
|
||||
int i, j, k;
|
||||
int len_a;
|
||||
|
||||
i = j = k = 0;
|
||||
len_a = 0;
|
||||
|
||||
while(i<(*La).length && j<Lb.length)
|
||||
{
|
||||
if((*La).elem[i]<Lb.elem[j])
|
||||
i++;
|
||||
else if((*La).elem[i]>Lb.elem[j])
|
||||
j++;
|
||||
else
|
||||
{
|
||||
if(!i || (*La).elem[i]!=(*La).elem[i-1])
|
||||
{
|
||||
(*La).elem[k] = (*La).elem[i];
|
||||
len_a++;
|
||||
k++;
|
||||
}
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
(*La).length = len_a;
|
||||
}
|
||||
|
||||
void PrintElem(LElemType_Sq e)
|
||||
{
|
||||
printf("%d ", e);
|
||||
void PrintElem(LElemType_Sq e) {
|
||||
printf("%2d ", e);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
* 题2.27
|
||||
*
|
||||
* 求交集:C=A∩B。
|
||||
* 不允许C中的元素重复,且C会利用A原有的空间,A被销毁。
|
||||
*
|
||||
* A和B中元素可能重复,但C中元素不重复。
|
||||
* 而且,要求C利用A原有的空间。
|
||||
*/
|
||||
SqList Algo_2_27(SqList* La, SqList Lb);
|
||||
Status Algo_2_27(SqList La, SqList Lb, SqList* Lc);
|
||||
|
||||
// 测试函数,打印元素
|
||||
void PrintElem(ElemType e);
|
||||
@@ -17,25 +19,26 @@ int main(int argc, char* argv[]) {
|
||||
SqList La, Lb, Lc;
|
||||
int i;
|
||||
|
||||
int a[10] = {1, 2, 2, 3, 4, 4, 9, 9, 10, 12};
|
||||
int b[10] = {1, 1, 2, 2, 3, 3, 4, 5, 12, 13};
|
||||
// 0号单元存储的是数组长度
|
||||
int a[] = {10, 1, 3, 3, 7, 9, 10, 13, 15, 15, 19};
|
||||
int b[] = {8, 1, 3, 7, 7, 10, 18, 18, 20};
|
||||
|
||||
// 准备测试数据
|
||||
// 准备测试数据,同一表中的元素值可能相同
|
||||
InitList(&La);
|
||||
InitList(&Lb);
|
||||
for(i = 1; i <= 10; i++) {
|
||||
ListInsert(&La, i, a[i - 1]);
|
||||
ListInsert(&Lb, i, b[i - 1]);
|
||||
for(i = 1; i <= a[0]; i++) {
|
||||
ListInsert(&La, i, a[i]);
|
||||
}
|
||||
for(i = 1; i <= b[0]; i++) {
|
||||
ListInsert(&Lb, i, b[i]);
|
||||
}
|
||||
|
||||
printf("La = ");
|
||||
ListTraverse(La, PrintElem);
|
||||
|
||||
printf("Lb = ");
|
||||
ListTraverse(Lb, PrintElem);
|
||||
|
||||
// 求交集
|
||||
Lc = Algo_2_27(&La, Lb);
|
||||
// 求交集,新链表的元素各不相同
|
||||
Algo_2_27(La, Lb, &Lc);
|
||||
|
||||
printf("Lc = ");
|
||||
ListTraverse(Lc, PrintElem);
|
||||
@@ -43,36 +46,41 @@ int main(int argc, char* argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 求交集:C=A∩B
|
||||
SqList Algo_2_27(SqList* La, SqList Lb) {
|
||||
|
||||
/*
|
||||
* 题2.27
|
||||
*
|
||||
* 求交集:C=A∩B。
|
||||
*
|
||||
* A和B中元素可能重复,但C中元素不重复。
|
||||
* 而且,要求C利用A原有的空间。
|
||||
*/
|
||||
Status Algo_2_27(SqList La, SqList Lb, SqList* Lc) {
|
||||
int i, j, k;
|
||||
SqList Lc;
|
||||
|
||||
// 确保La和Lb存在
|
||||
if((*La).elem == NULL || Lb.elem == NULL) {
|
||||
Lc.elem = NULL;
|
||||
Lc.length = 0;
|
||||
Lc.listsize = 0;
|
||||
return Lc;
|
||||
if(La.elem == NULL || Lb.elem == NULL) {
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
// 初始化Lc,使其直接使用La的存储空间
|
||||
*Lc = La;
|
||||
|
||||
i = j = 0; // 遍历La和Lb
|
||||
k = 0; // 遍历Lc
|
||||
|
||||
Lc.elem = (*La).elem;
|
||||
Lc.listsize = La->listsize;
|
||||
|
||||
// 只遍历La和Lb的共同部分就行
|
||||
while(i < (*La).length && j < Lb.length) {
|
||||
if((*La).elem[i] < Lb.elem[j]) {
|
||||
while(i < La.length && j < Lb.length) {
|
||||
if(La.elem[i] < Lb.elem[j]) {
|
||||
i++;
|
||||
} else if((*La).elem[i] > Lb.elem[j]) {
|
||||
} else if(La.elem[i] > Lb.elem[j]) {
|
||||
j++;
|
||||
|
||||
// 如果La和Lb中的元素相等
|
||||
} else {
|
||||
// 确保Lc中的元素不重复
|
||||
if(k == 0 || Lc.elem[k - 1] != (*La).elem[i]) {
|
||||
Lc.elem[k] = (*La).elem[i];
|
||||
// 如果Lc不为空,则需要保证其中的元素不重复
|
||||
if(k == 0 || (*Lc).elem[k - 1] != La.elem[i]) {
|
||||
(*Lc).elem[k] = La.elem[i];
|
||||
k++;
|
||||
}
|
||||
|
||||
@@ -81,16 +89,12 @@ SqList Algo_2_27(SqList* La, SqList Lb) {
|
||||
}
|
||||
}
|
||||
|
||||
// 销毁A,但其空间交给了C使用
|
||||
(*La).elem = NULL;
|
||||
(*La).length = 0;
|
||||
(*La).listsize = 0;
|
||||
// 更新顺序表Lc的长度
|
||||
(*Lc).length = k;
|
||||
|
||||
Lc.length = k;
|
||||
|
||||
return Lc;
|
||||
return OK;
|
||||
}
|
||||
|
||||
void PrintElem(ElemType e) {
|
||||
printf("%d ", e);
|
||||
printf("%2d ", e);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
* 题2.27
|
||||
*
|
||||
* 求交集:C=A∩B。
|
||||
* 不允许C中的元素重复,且C会利用A原有的空间,A被销毁。
|
||||
*
|
||||
* A和B中元素可能重复,但C中元素不重复。
|
||||
* 而且,要求C利用A原有的空间。
|
||||
*/
|
||||
SqList Algo_2_27(SqList* La, SqList Lb);
|
||||
Status Algo_2_27(SqList La, SqList Lb, SqList* Lc);
|
||||
|
||||
// 测试函数,打印元素
|
||||
void PrintElem(ElemType e);
|
||||
@@ -16,81 +18,84 @@ void PrintElem(ElemType e);
|
||||
int main(int argc, char* argv[]) {
|
||||
SqList La, Lb, Lc;
|
||||
int i;
|
||||
|
||||
int a[10] = {1, 2, 2, 3, 4, 4, 9, 9, 10, 12};
|
||||
int b[10] = {1, 1, 2, 2, 3, 3, 4, 5, 12, 13};
|
||||
|
||||
// 准备测试数据
|
||||
|
||||
// 0号单元存储的是数组长度
|
||||
int a[] = {10, 1, 3, 3, 7, 9, 10, 13, 15, 15, 19};
|
||||
int b[] = {8, 1, 3, 7, 7, 10, 18, 18, 20};
|
||||
|
||||
// 准备测试数据,同一表中的元素值可能相同
|
||||
InitList(&La);
|
||||
InitList(&Lb);
|
||||
for(i = 1; i <= 10; i++) {
|
||||
ListInsert(&La, i, a[i - 1]);
|
||||
ListInsert(&Lb, i, b[i - 1]);
|
||||
for(i = 1; i <= a[0]; i++) {
|
||||
ListInsert(&La, i, a[i]);
|
||||
}
|
||||
for(i = 1; i <= b[0]; i++) {
|
||||
ListInsert(&Lb, i, b[i]);
|
||||
}
|
||||
|
||||
printf("La = ");
|
||||
ListTraverse(La, PrintElem);
|
||||
|
||||
printf("Lb = ");
|
||||
ListTraverse(Lb, PrintElem);
|
||||
|
||||
// 求交集
|
||||
Lc = Algo_2_27(&La, Lb);
|
||||
|
||||
|
||||
// 求交集,新链表的元素各不相同
|
||||
Algo_2_27(La, Lb, &Lc);
|
||||
|
||||
printf("Lc = ");
|
||||
ListTraverse(Lc, PrintElem);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 求交集:C=A∩B
|
||||
SqList Algo_2_27(SqList* La, SqList Lb) {
|
||||
|
||||
/*
|
||||
* 题2.27
|
||||
*
|
||||
* 求交集:C=A∩B。
|
||||
*
|
||||
* A和B中元素可能重复,但C中元素不重复。
|
||||
* 而且,要求C利用A原有的空间。
|
||||
*/
|
||||
Status Algo_2_27(SqList La, SqList Lb, SqList* Lc) {
|
||||
int i, j, k;
|
||||
SqList Lc;
|
||||
|
||||
|
||||
// 确保La和Lb存在
|
||||
if((*La).elem == NULL || Lb.elem == NULL) {
|
||||
Lc.elem = NULL;
|
||||
Lc.length = 0;
|
||||
Lc.listsize = 0;
|
||||
return Lc;
|
||||
if(La.elem == NULL || Lb.elem == NULL) {
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
// 初始化Lc,使其直接使用La的存储空间
|
||||
*Lc = La;
|
||||
|
||||
i = j = 0; // 遍历La和Lb
|
||||
k = 0; // 遍历Lc
|
||||
|
||||
Lc.elem = (*La).elem;
|
||||
Lc.listsize = La->listsize;
|
||||
|
||||
|
||||
// 只遍历La和Lb的共同部分就行
|
||||
while(i < (*La).length && j < Lb.length) {
|
||||
if((*La).elem[i] < Lb.elem[j]) {
|
||||
while(i < La.length && j < Lb.length) {
|
||||
if(La.elem[i] < Lb.elem[j]) {
|
||||
i++;
|
||||
} else if((*La).elem[i] > Lb.elem[j]) {
|
||||
} else if(La.elem[i] > Lb.elem[j]) {
|
||||
j++;
|
||||
|
||||
// 如果La和Lb中的元素相等
|
||||
} else {
|
||||
// 确保Lc中的元素不重复
|
||||
if(k == 0 || Lc.elem[k - 1] != (*La).elem[i]) {
|
||||
Lc.elem[k] = (*La).elem[i];
|
||||
// 如果Lc不为空,则需要保证其中的元素不重复
|
||||
if(k == 0 || (*Lc).elem[k - 1] != La.elem[i]) {
|
||||
(*Lc).elem[k] = La.elem[i];
|
||||
k++;
|
||||
}
|
||||
|
||||
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
// 销毁A,但其空间交给了C使用
|
||||
(*La).elem = NULL;
|
||||
(*La).length = 0;
|
||||
(*La).listsize = 0;
|
||||
|
||||
Lc.length = k;
|
||||
|
||||
return Lc;
|
||||
|
||||
// 更新顺序表Lc的长度
|
||||
(*Lc).length = k;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void PrintElem(ElemType e) {
|
||||
printf("%d ", e);
|
||||
printf("%2d ", e);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
* 题2.27
|
||||
*
|
||||
* 求交集:C=A∩B。
|
||||
* 不允许C中的元素重复,且C会利用A原有的空间,A被销毁。
|
||||
*
|
||||
* A和B中元素可能重复,但C中元素不重复。
|
||||
* 而且,要求C利用A原有的空间。
|
||||
*/
|
||||
SqList Algo_2_27(SqList* La, SqList Lb);
|
||||
Status Algo_2_27(SqList La, SqList Lb, SqList* Lc);
|
||||
|
||||
// 测试函数,打印元素
|
||||
void PrintElem(ElemType e);
|
||||
@@ -17,25 +19,26 @@ int main(int argc, char* argv[]) {
|
||||
SqList La, Lb, Lc;
|
||||
int i;
|
||||
|
||||
int a[10] = {1, 2, 2, 3, 4, 4, 9, 9, 10, 12};
|
||||
int b[10] = {1, 1, 2, 2, 3, 3, 4, 5, 12, 13};
|
||||
// 0号单元存储的是数组长度
|
||||
int a[] = {10, 1, 3, 3, 7, 9, 10, 13, 15, 15, 19};
|
||||
int b[] = {8, 1, 3, 7, 7, 10, 18, 18, 20};
|
||||
|
||||
// 准备测试数据
|
||||
// 准备测试数据,同一表中的元素值可能相同
|
||||
InitList(&La);
|
||||
InitList(&Lb);
|
||||
for(i = 1; i <= 10; i++) {
|
||||
ListInsert(&La, i, a[i - 1]);
|
||||
ListInsert(&Lb, i, b[i - 1]);
|
||||
for(i = 1; i <= a[0]; i++) {
|
||||
ListInsert(&La, i, a[i]);
|
||||
}
|
||||
for(i = 1; i <= b[0]; i++) {
|
||||
ListInsert(&Lb, i, b[i]);
|
||||
}
|
||||
|
||||
printf("La = ");
|
||||
ListTraverse(La, PrintElem);
|
||||
|
||||
printf("Lb = ");
|
||||
ListTraverse(Lb, PrintElem);
|
||||
|
||||
// 求交集
|
||||
Lc = Algo_2_27(&La, Lb);
|
||||
// 求交集,新链表的元素各不相同
|
||||
Algo_2_27(La, Lb, &Lc);
|
||||
|
||||
printf("Lc = ");
|
||||
ListTraverse(Lc, PrintElem);
|
||||
@@ -43,36 +46,41 @@ int main(int argc, char* argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 求交集:C=A∩B
|
||||
SqList Algo_2_27(SqList* La, SqList Lb) {
|
||||
|
||||
/*
|
||||
* 题2.27
|
||||
*
|
||||
* 求交集:C=A∩B。
|
||||
*
|
||||
* A和B中元素可能重复,但C中元素不重复。
|
||||
* 而且,要求C利用A原有的空间。
|
||||
*/
|
||||
Status Algo_2_27(SqList La, SqList Lb, SqList* Lc) {
|
||||
int i, j, k;
|
||||
SqList Lc;
|
||||
|
||||
// 确保La和Lb存在
|
||||
if((*La).elem == NULL || Lb.elem == NULL) {
|
||||
Lc.elem = NULL;
|
||||
Lc.length = 0;
|
||||
Lc.listsize = 0;
|
||||
return Lc;
|
||||
if(La.elem == NULL || Lb.elem == NULL) {
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
// 初始化Lc,使其直接使用La的存储空间
|
||||
*Lc = La;
|
||||
|
||||
i = j = 0; // 遍历La和Lb
|
||||
k = 0; // 遍历Lc
|
||||
|
||||
Lc.elem = (*La).elem;
|
||||
Lc.listsize = La->listsize;
|
||||
|
||||
// 只遍历La和Lb的共同部分就行
|
||||
while(i < (*La).length && j < Lb.length) {
|
||||
if((*La).elem[i] < Lb.elem[j]) {
|
||||
while(i < La.length && j < Lb.length) {
|
||||
if(La.elem[i] < Lb.elem[j]) {
|
||||
i++;
|
||||
} else if((*La).elem[i] > Lb.elem[j]) {
|
||||
} else if(La.elem[i] > Lb.elem[j]) {
|
||||
j++;
|
||||
|
||||
// 如果La和Lb中的元素相等
|
||||
} else {
|
||||
// 确保Lc中的元素不重复
|
||||
if(k == 0 || Lc.elem[k - 1] != (*La).elem[i]) {
|
||||
Lc.elem[k] = (*La).elem[i];
|
||||
// 如果Lc不为空,则需要保证其中的元素不重复
|
||||
if(k == 0 || (*Lc).elem[k - 1] != La.elem[i]) {
|
||||
(*Lc).elem[k] = La.elem[i];
|
||||
k++;
|
||||
}
|
||||
|
||||
@@ -81,16 +89,12 @@ SqList Algo_2_27(SqList* La, SqList Lb) {
|
||||
}
|
||||
}
|
||||
|
||||
// 销毁A,但其空间交给了C使用
|
||||
(*La).elem = NULL;
|
||||
(*La).length = 0;
|
||||
(*La).listsize = 0;
|
||||
// 更新顺序表Lc的长度
|
||||
(*Lc).length = k;
|
||||
|
||||
Lc.length = k;
|
||||
|
||||
return Lc;
|
||||
return OK;
|
||||
}
|
||||
|
||||
void PrintElem(ElemType e) {
|
||||
printf("%d ", e);
|
||||
printf("%2d ", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user