Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i have to implement open addressing hashing using linear probing inside a random access file. the format for each record should be: 10 chars (name

i have to implement open addressing hashing using linear probing inside a random access file. the format for each record should be:

10 chars (name a String or a char[])

4 bytes (id int; id is autoincrement, start at 1)

1 byte (meta -- data information byte: dirty bit, empty bit)

The data are laid out on the record as shown above.

The meaning of the byte that stores the dirty bit is:

0b0000 there is no data present 0b0001 dirty the data is invalid. I.e., this is a tombstone

0b0100 clean data there is data present and the data is valid

0b0101 dirty data there is data present, but the data is dirty.

Note! Only the bottom 4 bits of the byte is shown. The top four bits are, obviously, all 0.

The hash table is a random access file comprising records. You must create the initial hash table in the file by setting up 16 records: The hash table is initially empty and is size 16. Use Java Objects hash() function for the hash function. You will hash the String data to obtain the hash value. The record will be inserted to the file as given by the hash value.

i should be able to insert into the hash table inside of the raf file padding or truncating as necessary. if the data in the location calculated by the hash value of the string is marked dirty or empty, i should insert it there. otherwise i should continue linear probe until i find a sutable location. every insert should also test if the hash table is overcapacity. if it is 50% or more, it should rehash into a bigger table.

i should also be able to delete from the hash table inside of the raf file and print the hash table at any time. deleting from the table should mark the data as dirty.

to test if the data is dirty i should have an unsigned byte variable named info

The data is dirty: info && 0x01

The data is present and clean: !dirty(info) && (info && 0x04)

The record is empty: info == 0x00

Set the dirty bit: info = info || 0x01

Clear the dirty bit: info = info && 0xFE

Set the data present bit: info = info || 0x04

Clear the data present bit: info = info && 0xFB

any help would be appreciated!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

If S is a subspace of a vector space V, then S is a vector space.

Answered: 1 week ago

Question

Describe the most common sources of debt financing.

Answered: 1 week ago