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

modify

上级 054ecf4a
...@@ -4,18 +4,18 @@ ...@@ -4,18 +4,18 @@
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
int i; int i;
LinkList* pListHead; // 单链表的表头指针,指向表头节点 LinkList* pListHead; // A pointer to the header of a single linked list
LinkList* pListNode; // 单链表节点指针 LinkList* pListNode; // Single list node pointer
LinkList* pListHeadTemp; LinkList* pListHeadTemp;
// //
// 初始化单链表的表头节点 // Initializes the header node of a single linked list
// //
pListHead = (LinkList*)malloc(sizeof(LinkList)); pListHead = (LinkList*)malloc(sizeof(LinkList));
pListHead->next = NULL; pListHead->next = NULL;
// //
// 初始化单链表的节点 // Initializes the nodes of a single list
// //
for(i=8; i>0; i--) for(i=8; i>0; i--)
{ {
...@@ -27,10 +27,10 @@ int main(int argc, char* argv[]) ...@@ -27,10 +27,10 @@ int main(int argc, char* argv[])
} }
// //
// 在第 i 个节点之前插入一个节点 // Insert a node before the ith node
// //
InsertBefore(pListHead, 3, 88); InsertBefore(pListHead, 3, 88);
InsertBefore(pListHead, 20, 15); // 插入位置非法.插入失败. InsertBefore(pListHead, 20, 15); // Invalid insert position. Insert failed.
pListHeadTemp = pListHead; pListHeadTemp = pListHead;
while(pListHeadTemp->next != NULL) while(pListHeadTemp->next != NULL)
...@@ -42,7 +42,7 @@ int main(int argc, char* argv[]) ...@@ -42,7 +42,7 @@ int main(int argc, char* argv[])
printf("\n"); printf("\n");
// //
// 销毁单链表 // Destroy single linked list
// //
while(pListHead->next != NULL) while(pListHead->next != NULL)
{ {
...@@ -57,20 +57,20 @@ int main(int argc, char* argv[]) ...@@ -57,20 +57,20 @@ int main(int argc, char* argv[])
/* /*
function: function:
在第 i 个节点之前插入一个节点. Insert a node before the ith node.
parameter: parameter:
pListHead -- 单链表的表头指针 pListHead -- A pointer to the head of a single linked list
i -- 插入节点的位置.从 1 开始计数. i -- The location of the insertion node.Count from 1.
Elem -- 插入节点的值. Elem -- Insert the value of the node.
returned value: returned value:
如果插入成功返回 1 Returns 1 if insert succeeds
如果插入失败返回 0 Returns 0 if insert fails
*/ */
int InsertBefore(LinkList* pListHead, int i, ElemType Elem) int InsertBefore(LinkList* pListHead, int i, ElemType Elem)
{ {
LinkList* pListNode; // 节点指针 LinkList* pListNode; // Node pointer
// //
// TODO: Add the code here // TODO: Add the code here
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论