Heaps of Hashing (Discussion 9) (Heap, bảng băm và mã băm) - Christine Zhou
Tài liệu thảo luận về heap, bảng băm và mã băm trong môn học cấu trúc dữ liệu, kèm theo bài tập và thông báo.
미리보기 생성 중...
Discussion 9: Heaps of Hashing Christine Zhou Agenda Announcements Heaps Problem 1 Hash tables Problem 2 Hash Codes Problem 3 Announcements Mid-semester survey due this Friday Less time to work on the problems by yourself Goes a little too slowly Don’t really need to talk to each other to discuss the problem Make sure to go through the harder problems Midterm coming up next week Start studying early! Advising sessions are updated weekly! tinyurl.com/cs61b-advising Project 2 Take a look at spec for extra credit opportunities! Start early! We’ll have extra office hours just like we did for Proj1 Refetch from shared to get an updated col/row Heaps Sometimes we want to prioritize elements in a certain way, always get the minimum Use a heap! Complete: missing items only at the bottom level and pushed as far left on the bottom level as possible (Min/Max) heap property: every node’s value is (less/greater) than or equal to its children’s value Common Methods of Heaps Insert Put new item in first free bottom leftmost position, then bubble up removeMin/removeMax Replace root item with the bottom rightmost item, then bubble down the root getMin/getMax Return the value at the root How do we represent heaps? 1 Heaps of fun 1 Heaps of fun HashMaps Use an array to represent your data For each key-value pair, assign each key a “hash code” mod (%) the hash code by the length of the array (this gives you a number between 0 and array.length - 1), use this as the index! N = num elements, M = num buckets, C = some constant If N/M > C, then increase M! N/M is called the load factor If we have multiple elements that go to same place in the array, usually we will keep track of a list Be careful about negative numbers when modding! This is called external chaining What is the runtime of .contains and .insert? 2 HashMap Modification Hash Codes What is necessary for a valid hash code? If A.equals(B) is
… 전체 문서를 읽으려면 원본 파일을 다운로드하세요.
- 문서명
- Heaps of Hashing (Discussion 9) (Heap, bảng băm và mã băm) - Christine Zhou
- 학교 / 강의
- University of California, Berkeley · Lập trình Java
- 내용
- Tài liệu thảo luận về heap, bảng băm và mã băm trong môn học cấu trúc dữ liệu, kèm theo bài tập và thông báo.
- 목차
- 이 문서는 명확한 목차가 없습니다.
- 페이지 수
- 13 페이지
- 업로더
- Giang Le
자주 묻는 질문
이 문서는 무료인가요?
네. “Heaps of Hashing (Discussion 9) (Heap, bảng băm và mã băm) - Christine Zhou” 문서는 무료입니다. 로그인 후 '다운로드'를 클릭하여 원본 파일을 받으세요.
이 문서는 몇 페이지로 되어 있나요?
이 문서는 13페이지입니다, Lập trình Java 과정용. 다운로드하기 전에 온라인으로 미리 볼 수 있습니다.
다운로드하기 전에 미리 볼 수 있나요?
네. 이 페이지의 온라인 리더를 통해 문서를 미리 본 후 다운로드 여부를 결정할 수 있습니다.

댓글 (0)
댓글이 없습니다. 첫 댓글을 남겨보세요!