TAILIEUCHUNG - A Complete Guide to Programming in C++ part 69

A Complete Guide to Programming in C++ part 69. This book provides both novice and experienced programmers with a comprehensive resource manual for the C++ programming language. Readers gain experience in all aspects of programming, from elementary language concepts to professional software development, with in depth coverage of all the language elements en route. These elements are carefully ordered to help the reader create useful programs every step of the way. | EXERCISES 659 Exercise 2 A hash file is required for speed of access to customer concept of hash files is explained on the opposite keep things simple each record in the hash file contains only a customer id and a customer id is the key used by the hash function opposite to compute the address of the record. Use linear solution as collision resolution technique. Note Linear solution provides for adequate access times if the address space is sufficiently large and not too full. It is also important to distribute the record numbers yielded by the hash function evenly throughout the available address hash function opposite will guarantee a good distribution if b is a sufficiently large prime number. Develop the HashEntry class used to represent customer need to store the customer id as an unsigned long value and the name of the customer as a char array with a length of 30. Supply default values for the constructor declaration and additionally declare the read_at and write_at methods that read customer information at a given position in a stream or write information at that position. Both methods expect the position and the stream as arguments. Define the HashFile class to represent a hash private members of the class comprise an fstream type file stream a string used to store the file name an int variable used to store the number b and the hash function shown opposite as a public members comprise a constructor that expects a file name and a number b as arguments. It opens the corresponding file for read and write destructor closes the file. Additionally declare the methods insert and retrieve to insert or retrieve single records. Both methods use a call to the hash function to compute the appropriate record number in the hash file. If a collision occurs the methods perform a sequential search to locate the next free slot in the address space mod of address space size or the desired customer .

TỪ KHÓA LIÊN QUAN
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.