Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e0419a1

Browse files
authored
Update 5.4.2维护链表尾指针.md
1 parent af80da3 commit e0419a1

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

‎5.4.2维护链表尾指针.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
- 维护链表尾指针
2-
- 问题:
3-
- head和tail分别是整数单链表的第一个和最后一个元素的全局指针。采用C语言为以下原型实现相应函数:
4-
5-
```cpp
6-
bool delete(Element *elem);
7-
bool insertAfter(Element *elem, int data);
8-
```
9-
10-
- delete的参数是待删除的元素。insert After的两个参数给出了要插入的新元素和对应的数据。能通过调用insert After并使用 NULL 作为元素参数来插入链表的开头。这些函数应该返回一个表示成功的布尔值。
11-
- 这些函数必须保持头尾指针一直指向最新位置。
12-
- 提示:
13-
- 普通情况:链表的长度 ≥ 3
14-
- 边界情况:代码需要考虑对于长度为0、1、2的链表是否能够正常工作。
1+
# 5.4.2维护链表尾指针
2+
- 问题:
3+
- head和tail分别是整数单链表的第一个和最后一个元素的全局指针。采用C语言为以下原型实现相应函数:
4+
5+
```cpp
6+
bool delete(Element *elem);
7+
bool insertAfter(Element *elem, int data);
8+
```
9+
10+
- delete的参数是待删除的元素。insert After的两个参数给出了要插入的新元素和对应的数据。能通过调用insert After并使用 NULL 作为元素参数来插入链表的开头。这些函数应该返回一个表示成功的布尔值。
11+
- 这些函数必须保持头尾指针一直指向最新位置。
12+
- 提示:
13+
- 普通情况:链表的长度 ≥ 3
14+
- 边界情况:代码需要考虑对于长度为0、1、2的链表是否能够正常工作。
1515

1616
参考代码:
1717
```cpp

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /