Question

In: Computer Science

Explain how to search for a record (using hashing) in a file where the records originally...

Explain how to search for a record (using hashing) in a file where the records originally were stored using modules method . for example the id was modulated by the size of the file.

Solutions

Expert Solution

read the snippet.

snippet 1:

snippet 2.

snippet 3.

snippet 4.

snippet 5.

snippet 6.

snippet 7.

snippet 8

snippet 9


Related Solutions

Suppose that we are using extendable hashing on a file that contains records with the following...
Suppose that we are using extendable hashing on a file that contains records with the following search-key values: (2, 3, 5, 7, 11, 17, 19, 23, 29, 31). Show the final extendable hash structure for this file if the hash function is h(x) = x mod 8 and buckets can hold three records. Recall that: 1. the bucket address table is indexed by the prefix of the binary representation of h(x). 2. Initially i = 0, i.e. the prefix consists...
Suppose we have a sequential ordered file of 200,000 records, where each record is 200 bytes....
Suppose we have a sequential ordered file of 200,000 records, where each record is 200 bytes. Assume blocksize = 2048 bytes (10 records per block), average seek time = 10 ms, average rotational delay = 8.3 ms, and block transfer time = 0.8 ms. Suppose we want to make X independent random record reads from the file. This could be done in two different approaches. read the entire file once and look for the X records of interest use a...
How to read and print all contents in a binary file using a Binary Search Tree...
How to read and print all contents in a binary file using a Binary Search Tree inorder traversal in C. Additionally, how to search using a Binary Search Tree to display the specific Athlete and his/her information. An example would be a sports record binary file that consist of name of athlete, height , weight, championships won. Athlete: Michael Jordan Height: 6’6” Weight : 205 lbs Championships won: 6 =================== Athlete: LeBron James Height: 6’8” Weight: 250 lbs Championships won:...
What is modulo and how is it used in a hashing function? Explain and give an...
What is modulo and how is it used in a hashing function? Explain and give an example. What is a collision in a hash table? Name and explain at least two ways in which a collision can be handled. Give examples.
Using Python. A file exists on the disk named students.txt. The file contains several records, and...
Using Python. A file exists on the disk named students.txt. The file contains several records, and each record contains two fields: (1) the student’s name, and (2) the student’s score for the final exam. Write code that deletes the record containing “John Perz”as the student name. This the code i have so far but it's not working: import os def main(): found=False search='John Perz' student_file = open('student.txt','r') temp_file = open('temp_students.txt','w') name=student_file.readline() score='' while name !='': score=student_file.readline() name=name.rstrip('/n') score=score.rstrip('/n') if name...
Using C, use mmap() to map a file to memory, and then search through it. For...
Using C, use mmap() to map a file to memory, and then search through it. For example, get and print out the first character of each line in the file: abc def ghi
search the file "myfile.txt" for any occurrences of "Some target string" and print the lines where...
search the file "myfile.txt" for any occurrences of "Some target string" and print the lines where the string is found. In this assignment, write your own java version of this program: Name the program LastnameFirstname1 (this is not really an appropriate name for such a program, but following this convention greatly eases the grading process). Example: WhiteMax1 Allow the user to specify the string they are searching for and the file they wish to search with command line arguments. To...
Explain how to record losses from uncollectible accounts using the direct write-off method. Explain how to...
Explain how to record losses from uncollectible accounts using the direct write-off method. Explain how to record losses from uncollectible accounts using the allowance method based on the percentage-of-sales method. Explain how to record losses from uncollectible accounts using the allowance method based on the percentage-of-receivables method. Explain how to record losses from uncollectible accounts using the allowance method based on aging-of-receivables method. Explain how to record the recovery of an account previously written off when the direct write-off method...
using python3 Write a Python program that lets a user search through the 'data.txt' file for...
using python3 Write a Python program that lets a user search through the 'data.txt' file for a given first name, last name, or email address, and print all the matches/results. Prompt the user for which field to search, (f) for first name, (l) for last name, or (e) for email data.txt entries are all formatted as: first_name, last_name, email, separated by TABS Your program should not read the entire file into memory, it should read line by line, and only...
1. Give a command using find to search from the root directory the file program.f and...
1. Give a command using find to search from the root directory the file program.f and redirect any errors to the file myerrors.txt 2. Give a command for finding files having the letters index as the beginning of the file name and located in your home directory (provide the absolute path) 3. Give a command for finding within a directory called /mp3collection, only those mp3 files that have a size less than 5000 Kilobytes (< 5MB). 4. Give a commmand...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT