Tree Traversals, Tries, KD Trees (Discussion 9) (Các phép duyệt cây) - Christine Zhou
正在生成预览...
Tài liệu thảo luận về các phép duyệt cây, Trie, và cây K-D, bao gồm lý thuyết và bài tập thực hành.
描述
Discussion 9: Tree Traversals, Tries, K-D Trees Christine Zhou Agenda K-D Tree review (with demos from lecture) K-D Tree problems Tree Traversal review Tree Traversal problems Trie review Trie problems Announcements Project 2B is due on Saturday, March 23 at 11:59pm. Remember that these are real deadlines (not "checkpoints") Midterm 2 is on April 5th from 8-10pm. Here are some events to keep on your radar! Check out Hug’s updated kd-tree nearest video @3426 Course Staff Guerrilla Section - 3/31 12-2PM Soda Labs HKN Review Session - 3/31 3-6PM HP Auditorium CSM Review Session - 4/1 6-9PM HP Auditorium Discussion survey: tinyurl.com/cz-disc9-sp19 Tree 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 Types of DFS: Preorder Pre-Order: “Visit” a node, then traverse its children preOrder(BSTNode x) { if (x == null) return; print(x.key) preOrder(x.left) preOrder(x.right) } Pre-Order: DBACFEG Hack: draw “pegs” on the left side of each node and take a walk around the edges of the tree. The Preorder is the order in which you hit the pegs Types of DFS: Inorder In-Order: Traverse left child, “visit” node, then traverse right child inOrder(BSTNode x) { if (x == null) return; inOrder(x.left) print(x.key) inOrder(x.right)} In-Order: ABCDEFG Hack: draw “pegs” on the bottom of each node and take a walk around the edges of the tree. The Inorder is the order in which you hit the pegs Types of DFS: Postorder Post-Order: Traverse children, then “visit” node. postOrder(BSTNode x) { if (x == null) return; postOrder(x.left) postOrder(x.right) print(x.key) } Post-Order: ACBEGFD Hack: draw “pegs” on the right side of each node and take a walk around the edges of the tree. The postorder is the order in which you hit the pegs Problem 1.1
AI 摘要
- 文档名称
- Tree Traversals, Tries, KD Trees (Discussion 9) (Các phép duyệt cây) - Christine Zhou
- 学校 / 课程
- University of California, Berkeley · Lập trình Java
- 内容
- Tài liệu này cung cấp kiến thức ôn tập và bài tập thực hành về K-D Tree, các phương pháp duyệt cây (BFS, DFS: Preorder, Inorder, Postorder) và cấu trúc dữ liệu Trie. Các khái niệm được giải thích rõ ràng kèm ví dụ và mẹo ghi nhớ, cùng với lời giải cho các bài tập.
- 目录
- Agenda
- Announcements
- Tree Traversals
- Types of DFS: Preorder
- Types of DFS: Inorder
- Types of DFS: Postorder
- Problem 1.1
- Solution
- Tries
- Runtime of Tries
- Problem 2.1
- Solutions
- 页数
- 65 页
- 上传者
- Uni24h
常见问题
此文档免费吗?
是的。“Tree Traversals, Tries, KD Trees (Discussion 9) (Các phép duyệt cây) - Christine Zhou”是免费的 — 只需登录并点击“下载”即可获取原始文件。
这份文档有多少页?
该文档共有 65 页,适用于课程 Lập trình Java。您可以在下载前进行在线预览。
我可以在下载前预览吗?
是的。您可以通过在线阅读器直接在本页面预览此文档,然后再决定是否下载。
Tree Traversals, Tries, KD Trees (Discussion 9) (Các phép duyệt cây) - Christine Zhou
正在生成预览...
Discussion 9: Tree Traversals, Tries, K-D Trees Christine Zhou Agenda K-D Tree review (with demos from lecture) K-D Tree problems Tree Traversal review Tree Traversal problems Trie review Trie problems Announcements Project 2B is due on Saturday, March 23 at 11:59pm. Remember that these are real deadlines (not "checkpoints") Midterm 2 is on April 5th from 8-10pm. Here are some events to keep on your radar! Check out Hug’s updated kd-tree nearest video @3426 Course Staff Guerrilla Section - 3/31 12-2PM Soda Labs HKN Review Session - 3/31 3-6PM HP Auditorium CSM Review Session - 4/1 6-9PM HP Auditorium Discussion survey: tinyurl.com/cz-disc9-sp19 Tree 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 Types of DFS: Preorder Pre-Order: “Visit” a node, then traverse its children preOrder(BSTNode x) { if (x == null) return; print(x.key) preOrder(x.left) preOrder(x.right) } Pre-Order: DBACFEG Hack: draw “pegs” on the left side of each node and take a walk around the edges of the tree. The Preorder is the order in which you hit the pegs Types of DFS: Inorder In-Order: Traverse left child, “visit” node, then traverse right child inOrder(BSTNode x) { if (x == null) return; inOrder(x.left) print(x.key) inOrder(x.right)} In-Order: ABCDEFG Hack: draw “pegs” on the bottom of each node and take a walk around the edges of the tree. The Inorder is the order in which you hit the pegs Types of DFS: Postorder Post-Order: Traverse children, then “visit” node. postOrder(BSTNode x) { if (x == null) return; postOrder(x.left) postOrder(x.right) print(x.key) } Post-Order: ACBEGFD Hack: draw “pegs” on the right side of each node and take a walk around the edges of the tree. The postorder is the order in which you hit the pegs Problem 1.1
阅读全文
- 文档名称
- Tree Traversals, Tries, KD Trees (Discussion 9) (Các phép duyệt cây) - Christine Zhou
- 学校 / 课程
- University of California, Berkeley · Lập trình Java
- 内容
- Tài liệu này cung cấp kiến thức ôn tập và bài tập thực hành về K-D Tree, các phương pháp duyệt cây (BFS, DFS: Preorder, Inorder, Postorder) và cấu trúc dữ liệu Trie. Các khái niệm được giải thích rõ ràng kèm ví dụ và mẹo ghi nhớ, cùng với lời giải cho các bài tập.
- 目录
- Agenda
- Announcements
- Tree Traversals
- Types of DFS: Preorder
- Types of DFS: Inorder
- Types of DFS: Postorder
- Problem 1.1
- Solution
- Tries
- Runtime of Tries
- Problem 2.1
- Solutions
- 页数
- 65 页
- 上传者
- 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)
暂无评论。快来抢沙发吧!