Data Structures (Discussion 6) (Cấu trúc dữ liệu Disjoint Sets và Asymptotics) - Christine Zhou
Đang tạo bản xem trước...
Tài liệu thảo luận số 6 môn CS61B (Data Structures) về cấu trúc dữ liệu Disjoint Sets và Asymptotics, bao gồm các phép toán quick find, quick union, weighted quick union và path compression.
Mô tả
CS61B Discussion 6 Disjoint Sets and Asymptotics Administrivia Fill out the weekly surveys! ○ Pacing points and feedback you have for us :); check Piazza! Midterm 1 solutions and grades are out! CSM sections are available, http://scheduler.csmentors.org/! Post-midterm advising appointments ○ Sign-up on Piazza or let me know if you want to talk in the discussion survey today. Optional online textbook! ○ You can find readings that correspond to the lecture videos under the ‘Readings’ column of the website Discussion survey (please fill this out!): tinyurl.com/cz-disc6-sp19 Disjoint Sets Also sometimes called “Union Find” keeps track of whether or not elements are connected ○ empires that are constantly conquering one another ○ each empire is identified by a ruling element. Three basic functions: Also sometimes called union(a, b) ○ connect(a, b) ■ brings b into a’s empire (a conquers b) ○ isConnected(a, b) ■ returns whether or not a and b are in the same empire. ○ find(a) ■ Returns the “ruler” of empire a. Implementations of Disjoint Sets Disjoint sets can be implemented in multiple ways, each with its own benefits and drawbacks. ○ Quick Find → quick to find if two are connected ○ Quick Union → quick to connect ○ Weighted Quick Union → quick union, but with some optimization Quick Find Use an array to store which set each element is in. Called quick find because it is very fast to find if two elements are in the same set (isConnected(a,b)), since you just need to check if id[a] = id[b]. 0 4 1 2 3 5 6 { 0, 1, 2, 4 }, {3, 5}, {6} 0 int[] id 0 1 2 3 4 5 6 0 0 3 0 3 6 Analogy: Each set is an “empire” and is identified by its ruler. 0, 3, 6 are the individual rulers and all the other elements belong to their empires. Quick Union Use an array to store the parent of each node -1 indicates that an item is a root. int[] parent 1 0 0 1 1 2 1 0 3 3 4 5 1 6 0 3 1 4 2 6 5 Weighted Quick Union Quick Union,
Tóm tắt AI
- Tên tài liệu
- Data Structures (Discussion 6) (Cấu trúc dữ liệu Disjoint Sets và Asymptotics) - Christine Zhou
- Trường / Môn
- University of California, Berkeley · Lập trình Java
- Nội dung
- Tài liệu giới thiệu cấu trúc dữ liệu Disjoint Sets với các phương pháp triển khai khác nhau (Quick Find, Quick Union, Weighted Quick Union) và phân tích hiệu năng. Nó cũng đưa ra các bài tập để củng cố kiến thức về Disjoint Sets.
- Mục lục
- Administrivia
- Disjoint Sets
- Implementations of Disjoint Sets
- Quick Find
- Quick Union
- Weighted Quick Union
- Weighted Quick Union with Path Compression
- Disjoint Set Runtimes
- Problem 1.1
- Problem 1.1 Solutions
- Problem 1.2
- Số trang
- 83 trang
- Người đăng
- Uni24h
Câu hỏi thường gặp
Tài liệu này có miễn phí không?
Có. “Data Structures (Discussion 6) (Cấu trúc dữ liệu Disjoint Sets và Asymptotics) - 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 83 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ề.
Data Structures (Discussion 6) (Cấu trúc dữ liệu Disjoint Sets và Asymptotics) - Christine Zhou
Đang tạo bản xem trước...
CS61B Discussion 6 Disjoint Sets and Asymptotics Administrivia Fill out the weekly surveys! ○ Pacing points and feedback you have for us :); check Piazza! Midterm 1 solutions and grades are out! CSM sections are available, http://scheduler.csmentors.org/! Post-midterm advising appointments ○ Sign-up on Piazza or let me know if you want to talk in the discussion survey today. Optional online textbook! ○ You can find readings that correspond to the lecture videos under the ‘Readings’ column of the website Discussion survey (please fill this out!): tinyurl.com/cz-disc6-sp19 Disjoint Sets Also sometimes called “Union Find” keeps track of whether or not elements are connected ○ empires that are constantly conquering one another ○ each empire is identified by a ruling element. Three basic functions: Also sometimes called union(a, b) ○ connect(a, b) ■ brings b into a’s empire (a conquers b) ○ isConnected(a, b) ■ returns whether or not a and b are in the same empire. ○ find(a) ■ Returns the “ruler” of empire a. Implementations of Disjoint Sets Disjoint sets can be implemented in multiple ways, each with its own benefits and drawbacks. ○ Quick Find → quick to find if two are connected ○ Quick Union → quick to connect ○ Weighted Quick Union → quick union, but with some optimization Quick Find Use an array to store which set each element is in. Called quick find because it is very fast to find if two elements are in the same set (isConnected(a,b)), since you just need to check if id[a] = id[b]. 0 4 1 2 3 5 6 { 0, 1, 2, 4 }, {3, 5}, {6} 0 int[] id 0 1 2 3 4 5 6 0 0 3 0 3 6 Analogy: Each set is an “empire” and is identified by its ruler. 0, 3, 6 are the individual rulers and all the other elements belong to their empires. Quick Union Use an array to store the parent of each node -1 indicates that an item is a root. int[] parent 1 0 0 1 1 2 1 0 3 3 4 5 1 6 0 3 1 4 2 6 5 Weighted Quick Union Quick Union,
Đọc toàn bộ tài liệu
- Tên tài liệu
- Data Structures (Discussion 6) (Cấu trúc dữ liệu Disjoint Sets và Asymptotics) - Christine Zhou
- Trường / Môn
- University of California, Berkeley · Lập trình Java
- Nội dung
- Tài liệu giới thiệu cấu trúc dữ liệu Disjoint Sets với các phương pháp triển khai khác nhau (Quick Find, Quick Union, Weighted Quick Union) và phân tích hiệu năng. Nó cũng đưa ra các bài tập để củng cố kiến thức về Disjoint Sets.
- Mục lục
- Administrivia
- Disjoint Sets
- Implementations of Disjoint Sets
- Quick Find
- Quick Union
- Weighted Quick Union
- Weighted Quick Union with Path Compression
- Disjoint Set Runtimes
- Problem 1.1
- Problem 1.1 Solutions
- Problem 1.2
- Số trang
- 83 trang
- Người đăng
- Uni24h
Bình luận (0)
Chưa có bình luận nào. Hãy là người đầu tiên!
Java DataBase Connectivity - Kết nối kho dữ liệu Java
Asymptotic Analysis (Discussion 7) (Phân tích tiệm cận) - Christine Zhou
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
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
Bình luận (0)
Chưa có bình luận nào. Hãy là người đầu tiên!