DFS, BFS, SPs, MSTs (Discussion 10) (Thuật toán duyệt đồ thị) - Christine Zhou
正在生成预览...
Tài liệu thảo luận về các thuật toán duyệt đồ thị (BFS, DFS, preorder, postorder) với bài tập và lời giải chi tiết.
描述
Discussion 10 DFS, BFS, SPs, MSTs Announcements Welcome back from spring break! Hope you had a restful week :) Reach out to your mentor GSI if you feel yourself falling behind, or are feeling overwhelmed -- we’re here for you! We want to help you finish as strong as you can. We will be running the full autograder for project 2AB on ~4/2 Midterm 2 this Friday, April 5th from 8-10pm! ○ Check out @3764 for important information about the midterm & review sessions! No lab due this week! We’ll be doing exam review in lab. 61B Imposter Syndrome Panel ○ Sunday, 4/7 from 5-6:30pm in Soda 310 Remember to complete the anonymous spring break survey for 8 points of EC! Discussion survey: tinyurl.com/cz-disc10-sp19 Agenda Focus on what has the highest votes, but we’ll try to get through everything! Graph Traversals Level-Order/Breadth First Search (BFS): ○ Visit top to bottom, left to right, just like how you read! Depth-order/Depth First Search (DFS): ○ Traverse “deeper” nodes before shallow ones Preorder vs. Postorder vs. Inorder (all types of DFS) Preorder: “Visit” a node, then traverse its children Inorder: Traverse left child, “visit” node, then traverse right child Postorder: Traverse children, then “visit” node. Note: The prefix to order (pre, in, post) refers to when a node is visited with respect to its children ○ ex) That’s why postorder means that we visit the node AFTER we visit the children (post is a prefix, meaning “behind,” “after,”) Note: Node and vertex are used interchangeably. Q1.1: Graphs Give the DFS preorder, DFS postorder, and BFS order of the graph traversals starting from vertex A. Break ties alphabetically. Q1.1: Implementing Post/Preorder Maintain a stack of nodes and a marked set. As soon as we add something to our stack, we note it for preorder. The top node in our stack represents the node we are currently on, and the marked set represents nodes that have been visited. After we add a node to the
AI 摘要
- 文档名称
- DFS, BFS, SPs, MSTs (Discussion 10) (Thuật toán duyệt đồ thị) - Christine Zhou
- 学校 / 课程
- University of California, Berkeley · Lập trình Java
- 内容
- Tài liệu này giải thích các khái niệm về DFS và BFS, cùng với các biến thể preorder, inorder, postorder của DFS. Nó cung cấp một ví dụ chi tiết về cách thực hiện DFS preorder và postorder trên một đồ thị cụ thể, bao gồm cả cách sử dụng stack và marked set.
- 目录
- Announcements
- Agenda
- Graph Traversals
- Preorder vs. Postorder vs. Inorder
- Q1.1: Graphs
- Q1.1: Implementing Post/Preorder
- Q1.1: DFS Pre/postorder Solution
- 页数
- 68 页
- 上传者
- Uni24h
常见问题
此文档免费吗?
是的。“DFS, BFS, SPs, MSTs (Discussion 10) (Thuật toán duyệt đồ thị) - Christine Zhou”是免费的 — 只需登录并点击“下载”即可获取原始文件。
这份文档有多少页?
该文档共有 68 页,适用于课程 Lập trình Java。您可以在下载前进行在线预览。
我可以在下载前预览吗?
是的。您可以通过在线阅读器直接在本页面预览此文档,然后再决定是否下载。
DFS, BFS, SPs, MSTs (Discussion 10) (Thuật toán duyệt đồ thị) - Christine Zhou
正在生成预览...
Discussion 10 DFS, BFS, SPs, MSTs Announcements Welcome back from spring break! Hope you had a restful week :) Reach out to your mentor GSI if you feel yourself falling behind, or are feeling overwhelmed -- we’re here for you! We want to help you finish as strong as you can. We will be running the full autograder for project 2AB on ~4/2 Midterm 2 this Friday, April 5th from 8-10pm! ○ Check out @3764 for important information about the midterm & review sessions! No lab due this week! We’ll be doing exam review in lab. 61B Imposter Syndrome Panel ○ Sunday, 4/7 from 5-6:30pm in Soda 310 Remember to complete the anonymous spring break survey for 8 points of EC! Discussion survey: tinyurl.com/cz-disc10-sp19 Agenda Focus on what has the highest votes, but we’ll try to get through everything! Graph Traversals Level-Order/Breadth First Search (BFS): ○ Visit top to bottom, left to right, just like how you read! Depth-order/Depth First Search (DFS): ○ Traverse “deeper” nodes before shallow ones Preorder vs. Postorder vs. Inorder (all types of DFS) Preorder: “Visit” a node, then traverse its children Inorder: Traverse left child, “visit” node, then traverse right child Postorder: Traverse children, then “visit” node. Note: The prefix to order (pre, in, post) refers to when a node is visited with respect to its children ○ ex) That’s why postorder means that we visit the node AFTER we visit the children (post is a prefix, meaning “behind,” “after,”) Note: Node and vertex are used interchangeably. Q1.1: Graphs Give the DFS preorder, DFS postorder, and BFS order of the graph traversals starting from vertex A. Break ties alphabetically. Q1.1: Implementing Post/Preorder Maintain a stack of nodes and a marked set. As soon as we add something to our stack, we note it for preorder. The top node in our stack represents the node we are currently on, and the marked set represents nodes that have been visited. After we add a node to the
阅读全文
- 文档名称
- DFS, BFS, SPs, MSTs (Discussion 10) (Thuật toán duyệt đồ thị) - Christine Zhou
- 学校 / 课程
- University of California, Berkeley · Lập trình Java
- 内容
- Tài liệu này giải thích các khái niệm về DFS và BFS, cùng với các biến thể preorder, inorder, postorder của DFS. Nó cung cấp một ví dụ chi tiết về cách thực hiện DFS preorder và postorder trên một đồ thị cụ thể, bao gồm cả cách sử dụng stack và marked set.
- 目录
- Announcements
- Agenda
- Graph Traversals
- Preorder vs. Postorder vs. Inorder
- Q1.1: Graphs
- Q1.1: Implementing Post/Preorder
- Q1.1: DFS Pre/postorder Solution
- 页数
- 68 页
- 上传者
- Uni24h
评论 (0)
暂无评论。快来抢沙发吧!
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
评论 (0)
暂无评论。快来抢沙发吧!