Exemplo n.º 1
0
Arquivo: test.c Projeto: XHXaiXXR/code
void Test4()//BubblingSort   EraseNotHead  ReverseLish  InsertFrontNode
{
	PSListNode ret = NULL;
	PSListNode pHead = NULL;
	InitList(&pHead);
	PushBack(&pHead,9);
	PushBack(&pHead,1);
	PushBack(&pHead,8);
	PushBack(&pHead,3);
	PushBack(&pHead,6);
	PrintList(&pHead);

	BubblingSort(&pHead);
	PrintList(&pHead);

	EraseNotHead(Find(&pHead,8));
	PrintList(&pHead);

	ReverseLish(&pHead);
	PrintList(&pHead);

	InsertFrontNode(Find(&pHead,3),15);
	PrintList(&pHead);

	ret = FindMidNode(&pHead);
	printf("%d\n",ret->data);

	DelKNode(&pHead,3);
	PrintList(&pHead);

	DestroyList(&pHead);
	PrintList(&pHead);

}
Exemplo n.º 2
0
void test6()
{
	LinkList list;
	LinkNode *ret = NULL;
	InitLinkList(&list);
	PushBack(&list, 3);
	PushBack(&list, 5);
	PushBack(&list, 4);
	PushBack(&list, 2);
	PushBack(&list, 1);
	PrintList(&list);
	//ret = FindNode(&list, 2);
	//InsertFrontNode(ret, 0);           //3 5 4 0 2 1
	//PrintList(&list);
	//ret=FindMidNode(&list);
	DelKNode(&list, 5);
	PrintList(&list);
	DestoryLinkList(&list);
}