Question

One way to decrease the table’s load factor is to make it bigger; that is, we...

One way to decrease the table’s load factor is to make it bigger; that is, we create a new table with more buckets and then transfer the items from the old table to the new one. Sketch pseudocode for this operation. Assume we have an existing array B of m buckets, and we are transferring its contents to a new array B′ of m′ > m buckets. Please specify which value, m or m′, is used by your toIndex() function.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
PseudoCode:
    1. Create a new array B' of bigger size m'
    2. For element e in array B =>
        a. Calculate index i = e % length of B' = e % m
        b. make B'[i] = e
    3. Replace the reference to old table by pointing to B'
           
           
We need to use m' in rehashing, as that is the new table size, and that will determine on which index a particular entry will be put.. 

So if Original array had size 13, and value 39 was going into index 0.. then now, may be with size 23, it will go to index 16. So rehashing should be done on the basis of new size.
Add a comment
Know the answer?
Add Answer to:
One way to decrease the table’s load factor is to make it bigger; that is, we...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Must figure out which test to use one way nova, block design, factorial 2. Four levels...

    Must figure out which test to use one way nova, block design, factorial 2. Four levels of treatment are applied to six different supplies of lumber. The data is presented on worksheet B. We are interested in if there are differences in the treatments and the supplies of lumber are considered not to be a factor. Create the ANOVA table and test the hypothesis that all four treatments are the same or are not the same.

  • I need to answer #3 could be done in only one way, we see that if...

    I need to answer #3 could be done in only one way, we see that if we take the table for G and rename the identity e, the next element listed a, and the last element b, the resulting table for G must be the same as the one we had for G. As explained in Section 3, this renaming gives an isomorphism of the group G' with the group G. Definition 3.7 defined the notion of isomorphism and of...

  • EE 282-Circuit I Pre-Lab 9 Maximum Power Transfer Theorem Name Concepts: In this pre-lab we will ...

    EE 282-Circuit I Pre-Lab 9 Maximum Power Transfer Theorem Name Concepts: In this pre-lab we will be leaming about Maximum Power Transfer Theorem. Maximum power is transferred to the load when the load resistance equals the thexenin equivalent, and we carry out the analysis using Thevenin's equivalent circuit. In order to do this, first build the following circuit on Mutism. 1 R1 5.1k0 R3 2 V1 R2 8kQ 6.8㏀ Fig. 1 Part 1: To find the Thevenin equivalent resistance, we...

  • c++ can use if else, loop,function ,array,file i.o. Can not use swtich, global variables etc..   Please...

    c++ can use if else, loop,function ,array,file i.o. Can not use swtich, global variables etc..   Please do all parts. previously I post 3 time for part1 ,2 and 3 but I can't make it into one complete program code. I even try to post a questions ask and post the 3 parts of code for experts to put it together. But experts said it's not enough information. please help... Thank you ! Program Objectives: Allow students to create arrays Allow...

  • (a) Load the data file data/tips.csv into a pandas DataFrame called tips_df using the pandas read_table()...

    (a) Load the data file data/tips.csv into a pandas DataFrame called tips_df using the pandas read_table() function. Check the first five rows. (b) Create a new dataframe called tips by randomly sampling 6 records from the dataframe tips_df. Refer to the sample() function documentation. (c) Add a new column to tips called idx as a list ['one', 'two', 'three', 'four', 'five', 'six'] and then later assign it as the index of tips dataframe. Display the dataframe. (d) Create a new...

  • Our 1st new array operation/method is remove. Implement as follows: public static boolean remove( int[] arr,...

    Our 1st new array operation/method is remove. Implement as follows: public static boolean remove( int[] arr, int count, int key ) { 1: find the index of the first occurance of key. By first occurance we mean lowest index that contains this value. hint: copy the indexOf() method from Lab#3 into the bottom of this project file and call it from inside this remove method. The you will have the index of the value to remove from the array 2:...

  • Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers...

    Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...

  • Hi!, having trouble with this one, In this class we use visual studio, C++ language --------------------------------------------------------------...

    Hi!, having trouble with this one, In this class we use visual studio, C++ language -------------------------------------------------------------- Exercise #10 Pointers - Complete the missing 5 portions of part1 (2 additions) and part2 (3 additions) Part 1 - Using Pointers int largeArray (const int [], int); int largePointer(const int * , int); void fillArray (int * , int howMany); void printArray (const char *,ostream &, const int *, int howMany); const int low = 50; const int high = 90; void main()...

  • Hash Tables. (Hint: Diagrams might be helpful for parts a) and b). ) When inserting into...

    Hash Tables. (Hint: Diagrams might be helpful for parts a) and b). ) When inserting into hash table we insert at an index calculated by the key modulo the array size, what would happen if we instead did key mod (array_size*2), or key mod (array_size/2)? (Describe both cases). Theory answer Here Change your hashtable from the labs/assignments to be an array of linkedlists – so now insertion is done into a linkedlist at that index. Implement insertion and search. This...

  • AA. Final Project - Improved JavaFX GUI Personal Lending Library Description: In this project we will...

    AA. Final Project - Improved JavaFX GUI Personal Lending Library Description: In this project we will improve our personal lending library tool by (1) adding the ability to delete items from the library, (2) creating a graphical user interface that shows the contents of the library and allows the user to add, delete, check out, or check in an item. (3) using a file to store the library contents so that they persist between program executions, and (4) removing the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT