提交 86057564 创建 作者: 宋海霞's avatar 宋海霞

modify

上级 058e716e
......@@ -5,18 +5,18 @@ int main(int argc, char* argv[])
{
int i;
ElemType Elem;
DuLinkList* pListHead; // 双向循环链表的表头指针,指向表头节点
DuLinkList* pListNode; // 双向循环链表节点指针
DuLinkList* pListHead; // A pointer to the head of a bidirectional circular list,Points to the header node
DuLinkList* pListNode; // Bidirectional circular list node pointer
DuLinkList* pListHeadTemp;
//
// 初始化双向循环链表的表头节点
// Initializes a pointer to the head node of a bidirectional circular list
//
pListHead = (DuLinkList*)malloc(sizeof(DuLinkList));
pListHead->prior = pListHead;
pListHead->next = pListHead;
//
// 初始化双向循环链表的节点
// Initializes the nodes of a bidirectional circular list
//
for(i=8; i>0; i--)
{
......@@ -30,10 +30,10 @@ int main(int argc, char* argv[])
}
//
// 删除第 i 个节点
// Delete the ith node
//
Delete(pListHead, 3, &Elem);
Delete(pListHead, 20, &Elem); // 删除位置非法.删除失败.
Delete(pListHead, 20, &Elem); // Illegal deletion of location. Deletion failed.
pListHeadTemp = pListHead;
pListNode = pListHeadTemp->next;
......@@ -45,7 +45,7 @@ int main(int argc, char* argv[])
printf("\n");
//
// 销毁双向循环链表
// Destroy bidirectional circular linked list
//
while(pListHead->next != pListHead)
{
......@@ -62,20 +62,20 @@ int main(int argc, char* argv[])
/*
function:
删除第 i 个节点.
Delete the ith node.
parameter:
pListHead -- 双向循环链表的表头指针
i -- 删除节点的位置.从 1 开始计数.
pElem -- 返回被删除节点的值.
pListHead -- A pointer to the head of a bidirectional circular list
i -- Delete the location of the node.Count from 1.
pElem -- Returns the value of the deleted node.
returned value:
如果删除成功返回 1
如果删除失败返回 0
Returns 1 if deletion succeeds
Returns 1 if deletion fails
*/
int Delete(DuLinkList* pListHead, int i, ElemType* pElem)
{
DuLinkList* pListNode; // 节点指针
DuLinkList* pListNode; // Node pointer
//
// TODO: Add the code here
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论