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

modify

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