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
… Tải file gốc để đọc toàn bộ tài liệu.
- ドキュメント名
- 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 ページ
- アップロード者
- Giang Le
よくある質問
Tài liệu này có miễn phí không?
Có. “DFS, BFS, SPs, MSTs (Discussion 10) (Thuật toán duyệt đồ thị) - 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 68 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ề.

コメント (0)
まだコメントはありません。最初のコメントを書きましょう!