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.
Generating preview...
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
… Tải file gốc để đọc toàn bộ tài liệu.
- Document name
- Linked Lists, Arrays (Discussion 3) (Danh sách liên kết và mảng) - Christine Zhou
- School / Course
- University of California, Berkeley · Lập trình Java
- Content
- 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.
- Table of contents
- 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
- Doc.pages
- 28 pages
- Uploaded by
- Giang Le
Frequently asked questions
Tài liệu này có miễn phí không?
Có. “Linked Lists, Arrays (Discussion 3) (Danh sách liên kết và mảng) - Christine Zhou” miễn phí — bạn chỉ cần đăng nhập rồi bấm Tải xuống để lấy file gốc.
Tài liệu dài bao nhiêu trang?
Tài liệu gồm 28 trang, thuộc môn Lập trình Java. Bạn có thể xem trước online trước khi tải.
Tôi có thể xem trước trước khi tải không?
Có. Bạn xem trước tài liệu ngay trên trang này bằng trình đọc online, rồi quyết định tải về.

Comments (0)
No comments yet. Be the first!