TAILIEUCHUNG - data structures and algorithms in C PHẦN 9

và các thuật toán từ. NET Framework Class Library cũng như những người phải được phát triển Trong một thời trang theo định hướng đối tượng, tác giả trình bày mảng và ArrayLists, danh sách liên kết, bảng băm, từ điển, cây, đồ thị, phân loại và tìm kiếm cũng như các thuật toán tiên tiến, chẳng hạn như các thuật toán xác suất và lập trình năng động. | 520 e Chapter 10 Hashing if not -1 . not reserved assign firstLetterValue and or lastLetterValue asg-values offirstletter word and or lastletter word return success return failure We can use this algorithm to build a hash function for the names of the nine Muses Calliope Clio Erato Euterpe Melpomene Polyhymnia Terpsichore Thalia and Urania. A simple count of the letters renders the number of times a given letter occurs as a first and last letter case sensitivity is disregarded E 6 A 3 c 2 o 2 T 2 M 1 p 1 and u 1 . According to these frequencies the words can be put in the following order Euterpe E occurs six times as the first and the last letter Calliope Erato Terpsichore Melpomene Thalia Clio Polyhymnia and Urania. Now the procedure search is applied. Figure contains a summary of its execution in which Max 4. First the word Euterpe is tried. E is assigned the g-value of 0 whereby h Euterpe 7 which is put on the list of reserved hash values. Everything goes well until Urania is tried. All five possible g-values for u result in an already reserved hash value. The procedure backtracks to the preceding step when Polyhymnia was tried. Its current hash value is detached from the list and the g-value of 1 is tried for P which causes a failure but 2 for p gives 3 for the hash value so the algorithm can continue. Urania is tried again five times then the fifth attempt is successful. All the names have been assigned unique hash values and the search process is finished. If the g-values for each letter are A c - E o M T 0 p 2 and u 4 then h is the minimal perfect hash function for the nine Muses. The searching process in Cichelli s algorithm is exponential since it uses an exhaustive search and thus it is inapplicable to a large number of words. Also it does not guarantee that a perfect hash function can be found. For a small number of words however it usually gives good results. This program often needs to be run only once and the resulting hash function can be .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.