Skip to content

Commit

Permalink
🐛 (kangjianwei#22)修复习题2.4与2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
kangjianwei committed Apr 29, 2020
1 parent 713278a commit fbf7c3c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ while(T->next!=NULL)
}
```

![2.4.7](_v_images/20181125014323122_29833.png)
![2.4.7](_v_images/20200429182822302_24342.png)

> 注:虽然原图中最后有省略号,但是在做此题时应将S结点视为链表的最后一个结点。
>   因为从出题人的角度出发,该题与2.4.6题要形成对照。
### 2.5 画出执行下列各行语句后各指针及链表的示意图。

Expand Down Expand Up @@ -141,7 +144,7 @@ for(i=1; i<=3; i++)
### 2.7 已知L是带表头结点的非空单链表,且P结点既不是首元结点,也不是尾元结点,试从下列提供的答案中选择合适的语句序列。
>a.删除P结点的直接后继结点的语句序列是 <u>(11)(3)(14)</u>。</br>
>b.删除P结点的直接前驱结点的语句序列是 <u>(10)(12)(8)(3)(14)</u>。</br>
>b.删除P结点的直接前驱结点的语句序列是 <u>(10)(12)(8)(11)(3)(14)</u>。</br>
>c.删除P结点的语句序列是 <u>(10)(12)(7)(3)(14)</u>。</br>
>d.删除首元结点的语句序列是 <u>(12)(11)(3)(14)</u>。</br>
>e.删除尾元结点的语句序列是 <u>(9)(11)(3)(14)</u>。</br>
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 17 additions & 13 deletions 习题解析/02 线性表/第02章 线性表.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ while(T->next!=NULL)
}
```

![2.4.7](_v_images/20181125014323122_29833.png)
![2.4.7](_v_images/20200429182140887_31499.png)

> 注:虽然原图中最后有省略号,但是在做此题时应将S结点视为链表的最后一个结点。
> &emsp;&emsp;因为从出题人的角度出发,该题与2.4.6题要形成对照。

### 2.5 画出执行下列各行语句后各指针及链表的示意图。

Expand Down Expand Up @@ -118,7 +122,7 @@ for(i=1; i<=3; i++)
>b.在P结点前插入S结点的语句序列是 <u>(7)(11)(8)(4)(1)</u>。
>c.在表首插入S结点的语句序列是 <u>(5)(12)</u>。
>d.在表尾插入S结点的语句序列是 <u>(9)(1)(6)</u>。
>
>
>(1)P->next=S;
>(2)P->next=P->next->next;
>(3)P->next=S->next;
Expand All @@ -127,9 +131,9 @@ for(i=1; i<=3; i++)
>(6)S->next=NULL;
>(7)Q=P;
>(8)while(P->next!=Q)
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P=P->next;
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P=P->next;
>(9)while(P->next!=NULL)
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P=P->next;
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P=P->next;
>(10)P=Q;
>(11)P=L;
>(12)L=S;
Expand All @@ -138,7 +142,7 @@ for(i=1; i<=3; i++)
### 2.7 已知L是带表头结点的非空单链表,且P结点既不是首元结点,也不是尾元结点,试从下列提供的答案中选择合适的语句序列。
>a.删除P结点的直接后继结点的语句序列是 <u>(11)(3)(14)</u>。
>b.删除P结点的直接前驱结点的语句序列是 <u>(10)(12)(8)(3)(14)</u>。
>b.删除P结点的直接前驱结点的语句序列是 <u>(10)(12)(8)(11)(3)(14)</u>。
>c.删除P结点的语句序列是 <u>(10)(12)(7)(3)(14)</u>。
>d.删除首元结点的语句序列是 <u>(12)(11)(3)(14)</u>。
>e.删除尾元结点的语句序列是 <u>(9)(11)(3)(14)</u>。
Expand All @@ -148,18 +152,18 @@ for(i=1; i<=3; i++)
>(3)P->next=P->next->next;
>(4)P=P->next->next;
>(5)while(P!=NULL)
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P=P->next;
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P=P->next;
>(6)while(Q->next!=NULL)
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P=Q;
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Q=Q->next;
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P=Q;
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Q=Q->next;
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
>(7)while(P->next!=Q)
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P=P->next;
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P=P->next;
>(8)while(P->next->next!=Q)
>&nbsp;&nbsp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