Linked Lists, Arrays (Discussion 3) (Danh sách liên kết và mảng) - Christine Zhou
Generating preview...
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.
Description
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
AI summary
- 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
- Pages
- 28 pages
- Uploaded by
- Uni24h
Frequently asked questions
Is this document free?
Yes. “Linked Lists, Arrays (Discussion 3) (Danh sách liên kết và mảng) - Christine Zhou” is free — just sign in and click Download to get the original file.
How many pages is this document?
The document has 28 pages, for the course Lập trình Java. You can preview it online before downloading.
Can I preview before downloading?
Yes. You can preview this document right on this page with the online reader, then decide whether to download.
Linked Lists, Arrays (Discussion 3) (Danh sách liên kết và mảng) - Christine Zhou
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
Read full document
- 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
- Pages
- 28 pages
- Uploaded by
- Uni24h
Comments (0)
No comments yet. Be the first!
Misc.onclusion (Discussion 14-END) (Ôn tập cấu trúc dữ liệu) - Christine Zhou
Final Review Solutions (Cấu trúc dữ liệu heap, hàng đợi ưu tiên và duyệt đồ thị) - Ching and Christines
Giáo trình Lập trình Java
Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
Asymptotic Analysis (Discussion 7) (Phân tích tiệm cận) - Christine Zhou
Chương 7.Cơ học lượng tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 6.Quang học lượng tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 5.Thuyết tương đối - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 4. Tán xạ ánh sáng - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 3.Phân cực ánh sáng - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Comments (0)
No comments yet. Be the first!