赞
踩
- /********************************************************************
- created: 2005/12/25
- created: 25:12:2005 9:41
- filename: queue.h
- author: Liu Qi, ngaut#126.com
- purpose: 链队列的定义与实现
- *********************************************************************/
- #ifndef QUEUE_H
- #define QUEUE_H
- #include <stdio.h>
- #include <malloc.h>
- #include <assert.h>
- typedef int ElemType;
- typedef struct
- {
- ElemType Element;
- struct Node* Next;
- } Node;
- typedef Node* PNode;
- typedef struct
- {
- PNode front;
- PNode rear;
- } Queue;
- /*===========================================================================
- * Function name: MakeNode
- * Parameter: target:元素的值
- * Precondition: void
- * Description: 构造一个节点,其值为target,Next为NULL
- * Return value: 指向新节点的指针
- * Author: Liu Qi, [12/25/2005]
- ===========================================================================*/
- static PNode MakeNode(ElemType target)
- {
- PNode PNewNode = (PNode) malloc(sizeof(Node));
- assert( NULL != PNewNode );
- PNewNode->Element = target;
- PNewNode->Next = NULL;
- return PNewNode;
- }
- /*==================================================================
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。