Linked Lists, Arrays (Discussion 3) (Danh sách liên kết và mảng) - Christine Zhou
Tài liệu thảo luận về danh sách liên kết và mảng, bao gồm ôn tập SLLists, DLLists và các bài tập thực hành.
正在生成预览...
Discussion 3: Linked Lists & Arrays Christine Zhou Agenda Administrivia Review of SLLists SLList problems (1.1, 1.2) Review of arrays Array problems (2.1, 2.2) Preface Lots of questions on the discussion today. These are for practice! We will not be able to get through all of them. Administrivia Project 1A due this Friday! Implementing deque interface, highly recommend to use Java Visualizer. Start early!! Office hours: pay special attention to the locations! CSM sign-ups will open tonight, 9pm, and is first come first served! Opportunity to get extra help in a small-group setting with a mentor. Pre-semester advising still available @414 (Email me!) Choose Mentor GSI’s and see the automated extension system at registration.datastructur.es Survey: tinyurl.com/cz-disc3-sp19 (please fill this out so I know what to focus on today!) Review: IntList public class IntList { public int first; public IntList rest; public IntList(int f, IntList r) { first = f; rest = r; } ... } Our IntList! What’s wrong with it? All the fields are public Calling each link an IntList does not seem entirely correct... Review: SLList Access modifiers changed to private Outside users cannot access fields directly public class SLList { Hides the internals using encapsulation private class IntNode { Hide the inner workings of the list from the private int item; user, store info about the list (ex. size) private IntNode next; private IntNode(int i, IntNode - n) User sees the list as a whole, not the { individual nodes of the list, and does not item = i; have to deal with logic of pointer next = n; manipulation } Analogy: You refer to a train as a whole, not as } individual cars. Instead of dealing with the raw private IntNode first; public SLList(int x) { links with first and next, you refer to it as a first = new IntNode(x, null); whole. } public int get(int position) { ... } Review: SLList Diagram We add a size variable so we don’t have to step through t
… 下载原始文件以阅读完整文档。
- 文档名称
- Linked Lists, Arrays (Discussion 3) (Danh sách liên kết và mảng) - Christine Zhou
- 学校 / 课程
- University of California, Berkeley · Lập trình Java
- 内容
- Tài liệu ôn tập về danh sách liên kết (SLList) và mảng, giới thiệu sentinel node, và đưa ra các bài tập thực hành về chèn và đảo ngược danh sách liên kết.
- 目录
- Agenda
- Preface
- Administrivia
- Review: IntList
- Review: SLList
- Review: SLList Diagram
- Review: SLList
- Review: Sentinel Node Diagram
- 1.1) SLList.insert
- 1.2) SLList.reverse
- Review: DLLists
- 页数
- 28 页
- 上传者
- Giang Le
常见问题
此文档免费吗?
是的。“Linked Lists, Arrays (Discussion 3) (Danh sách liên kết và mảng) - Christine Zhou”是免费的 — 只需登录并点击“下载”即可获取原始文件。
这份文档有多少页?
该文档共有 28 页,适用于课程 Lập trình Java。您可以在下载前进行在线预览。
我可以在下载前预览吗?
是的。您可以通过在线阅读器直接在本页面预览此文档,然后再决定是否下载。

评论 (0)
暂无评论。快来抢沙发吧!