COMP1511 Exam 3 急救路线图
非 UNSW 官方材料。本文基于官方 pointers、malloc/free、linked list 和 debugging 相关公开资料做中文转述;不复制真实考试题正文。[S016][S017][S018][S019][S004]
今天只做:画链表,写 traversal,再写一条
head/curr/prev/free错因。 下一步:主控台 · 第 7 课 · 练习菜单 别乱跳:第三次先保 traversal,再保删除。
先把目标缩小
Exam 3 先保 pointers、malloc/free、linked list 遍历、插入和删除;这些主题集中出现在 Lecture 10 到 Lecture 13/14。[S016][S017][S018][S019]
| 优先级 | 练什么 | 过关线 |
|---|---|---|
| 1 | 指针读法 | 分清 & 和 * |
| 2 | malloc/free | 申请、检查、释放 |
| 3 | traversal | curr != NULL |
| 4 | delete | 能处理删头 |
今日 3 轮
- 画 1 条链表。
- 写 1 个 traversal。
- 写 1 条错因:我错在
head、curr、prev、还是free?
最小模板
linked list 题先写 traversal;插入删除都是在这个安全移动基础上加逻辑。[S017][S018][S019]
struct node *curr = head;
while (curr != NULL) {
curr = curr->next;
}
引用
- [S004] COMP1511 Debugging Guide: https://cgi.cse.unsw.edu.au/~cs1511/26T1/resources/debugging_guide.html
- [S016] Lecture 10 PDF: https://cgi.cse.unsw.edu.au/~cs1511/26T1/slides/week_5/COMP1511_26T1_Lecture10.pdf
- [S017] Lecture 11 PDF: https://cgi.cse.unsw.edu.au/~cs1511/26T1/slides/week_7/COMP1511_26T1_Lecture11.pdf
- [S018] Lecture 13 PDF: https://cgi.cse.unsw.edu.au/~cs1511/26T1/slides/week_8/COMP1511_26T1_Lecture13.pdf
- [S019] Lecture 13/14 PDF: https://cgi.cse.unsw.edu.au/~cs1511/26T1/slides/week_9/COMP1511_26T1_Lecture1314.pdf