1. Trang chủ
  2. » Tất cả

Cấu trúc dữ liệu và thuật toán dsa ch12 hash

45 7 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 45
Dung lượng 916,85 KB

Nội dung

Hash Dr Rang Nguyen Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid square Mid square Folding Collision resolution Open addressing Linked list resolution 12 1 Chapter[.]

Hash Dr Rang Nguyen Chapter 12 Hash Basic concepts Hash functions Direct Hashing Data Structures and Algorithms Modulo division Digit extraction Mid-square Mid-square Folding Collision resolution Dr Rang Nguyen Faculty of Computer Science and Engineering University of Technology, VNU-HCM Open addressing Linked list resolution 12.1 Hash Outcomes Dr Rang Nguyen • L.O.5.1 - Depict the following concepts: hashing table, key, collision, and collision resolution • L.O.5.2 - Describe hashing functions using pseudocode and give examples to show their algorithms • L.O.5.3 - Describe collision resolution methods using pseudocode and give examples to show their algorithms • L.O.5.4 - Implement hashing tables using C/C++ Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square • L.O.5.5 - Analyze the complexity and develop experiment (program) to evaluate methods supplied for hashing tables • L.O.1.2 - Analyze algorithms and use Big-O notation to characterize the computational complexity of algorithms composed by using the following control structures: sequence, branching, and iteration (not recursion) Folding Collision resolution Open addressing Linked list resolution 12.2 Hash Contents Dr Rang Nguyen Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square Folding Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square Folding Collision resolution Open addressing Linked list resolution Collision resolution Open addressing Linked list resolution 12.3 Hash Dr Rang Nguyen Basic concepts Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square Folding Collision resolution Open addressing Linked list resolution 12.4 Hash Basic concepts Dr Rang Nguyen • Sequential search: O(n) • Binary search: O(log2 n) Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square → Requiring several key comparisons before the target is found Folding Collision resolution Open addressing Linked list resolution 12.5 Hash Basic concepts Dr Rang Nguyen Search complexity: Size Binary Sequential (Average) 16 50 25 256 128 1,000 10 500 10,000 14 5,000 100,000 17 50,000 1,000,000 20 500,000 Sequential (Worst Case) 16 50 256 1,000 10,000 100,000 1,000,000 Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square Folding Collision resolution Open addressing Linked list resolution 12.6 Hash Basic concepts Dr Rang Nguyen Is there a search algorithm whose complexity is O(1)? Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square Folding Collision resolution Open addressing Linked list resolution 12.7 Hash Basic concepts Dr Rang Nguyen Is there a search algorithm whose complexity is O(1)? YES Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square Folding Collision resolution Open addressing Linked list resolution 12.7 Hash Basic concepts Dr Rang Nguyen Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square Folding Collision resolution Open addressing Linked list resolution Hình: Each key has only one address 12.8 Hash Basic concepts Dr Rang Nguyen Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square Folding Collision resolution Open addressing Linked list resolution 12.9 ... resolution 12.2 Hash Contents Dr Rang Nguyen Basic concepts Hash functions Direct Hashing Modulo division Digit extraction Mid-square Mid-square Folding Basic concepts Hash functions Direct Hashing Modulo... resolution 12.15 Hash Hash functions Dr Rang Nguyen • • • • • • • Direct hashing Modulo division Digit extraction Mid-square Folding Rotation Pseudo-random Basic concepts Hash functions Direct Hashing... addressing Linked list resolution 12.16 Hash Direct Hashing Dr Rang Nguyen Basic concepts Hash functions The address is the key itself: hash( Key) = Key Direct Hashing Modulo division Digit extraction

Ngày đăng: 25/03/2023, 07:20

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w