Question

Please answer each question in exchange for an immediate upvote. Incomplete answers will be downvoted. If...

Please answer each question in exchange for an immediate upvote. Incomplete answers will be downvoted. If the questions aren't worth your time please move on and allow another person to answer. Thank you!

Short Answer:

1. Assume the following hash function. Multiply the Unicode value of each character by a factor, g, based on the character’s position within the string. The hash code is the sum of these products.
               u0gn-1 + u0gn-2 + … + un-2g + un-1
The Unicode value for uppercase ‘A’ = 65. Calculate the hash code for “ACE” with g = 7.

2. Assume the following hash function. Multiply the Unicode value of each character by a factor, g, based on the character’s position within the string. The hash code is the sum of these products.
               u0gn-1 + u0gn-2 + … + un-2g + un-1

3. Assume you have a hash table length of 53. Given the value 216, what index will the entry map to?
The Unicode value for uppercase ‘A’ = 65. Calculate the hash code for “FACE” with g = 7.

Homework Answers

Answer #1

Q1. Assume the following hash function. Multiply the Unicode value of each character by a factor, g, based on the character’s position within the string. The hash code is the sum of these products.
               u0gn-1 + u0gn-2 + … + un-2g + un-1
The Unicode value for uppercase ‘A’ = 65. Calculate the hash code for “ACE” with g = 7.

Answer:----------

A = 65, C = 67, E = 69.
With g = 7,
we have 65 * 9 + 67 * 3 + 69 * 1 = 855

Q2. Assume the following hash function. Multiply the Unicode value of each character by a factor, g, based on the character’s position within the string. The hash code is the sum of these products.
               u0gn-1 + u0gn-2 + … + un-2g + un-1

The Unicode value for uppercase ‘A’ = 65. Calculate the hash code for “FACE” with g = 7.

Answer:----------
F = 70, A = 65, C = 67, E = 69.
With g = 7,
we have 70 * 27 + 65 * 9 + 67 * 3 + 69 * 1 = 2745

Know the answer?
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
Similar Questions
This question is broken into 3 parts, each of which builds on the functions developed in...
This question is broken into 3 parts, each of which builds on the functions developed in the previous part. Note that you can (and should) still answer parts (b) and (c) even if you cannot answer the preceding parts - just assume that the functions work as they should, and continue. Please explain the code as well Write a C function called weighted_digit_sum that takes a single integer as input, and returns a weighted sum of that numbers digits. The...
Please answer the following C question: There is a documented prototype for a function called get_a_line...
Please answer the following C question: There is a documented prototype for a function called get_a_line in the code below. Write a definition for get_a_line—the only function called from that definition should be fgetc. #include <stdio.h> #include <string.h> #define BUFFER_ARRAY_SIZE 10 int get_a_line(char *s, int size, FILE *stream); // Does what fgets does, using repeated calls to fgetc, but // provides a more useful return value than fgets does. // // REQUIRES // size > 1. // s points to...
Arrays, loops, functions: Lotto Element Repeated Function Write a function that that takes as parameters an...
Arrays, loops, functions: Lotto Element Repeated Function Write a function that that takes as parameters an array of ints, an int value named element, and an int value named end. Return a bool based on whether the element appears in the array starting from index 0 and up to but not including the end index. Generate Random Array Write a function that takes as parameters an array of integers and another integer for the size of the array. Create a...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as possible: What is a checked exception, and what is an unchecked exception? What is NullPointerException? Which of the following statements (if any) will throw an exception? If no exception is thrown, what is the output? 1: System.out.println( 1 / 0 ); 2: System.out.println( 1.0 / 0 ); Point out the problem in the following code. Does the code throw any exceptions? 1: long value...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop a class, using templates, to provide functionality for a set of recursive functions. The functions specified as recursive must be written recursively (not iterativly). The UML class specifications are provided below. A main will be provided. Additionally, a make file will need to be developed and submitted. ● Recursion Set Class The recursion set template class will implement the template functions. recursionSet -length: int...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop a class, using templates, to provide functionality for a set of recursive functions. The functions specified as recursive must be written recursively (not iterativly). The UML class specifications are provided below. A main will be provided. Additionally, a make file will need to be developed and submitted. ● Recursion Set Class The recursion set template class will implement the template functions. recursionSet -length: int...
2. For every question, please write down each main step before you obtain the final answer....
2. For every question, please write down each main step before you obtain the final answer. Correct final answer with incorrect related work (calculation) or without any work may receive 0 point. On the contrary, incorrect final answer with correct related work (calculation) will receive partial credits. Question 1 –Debt Issue [6 points]: Eagle Sports Products (ESP) is considering issuing debt to raise funds to finance its growth during the next few years. The amount of the issue will be...
Use python language please #One of the early common methods for encrypting text was the #Playfair...
Use python language please #One of the early common methods for encrypting text was the #Playfair cipher. You can read more about the Playfair cipher #here: https://en.wikipedia.org/wiki/Playfair_cipher # #The Playfair cipher starts with a 5x5 matrix of letters, #such as this one: # # D A V I O # Y N E R B # C F G H K # L M P Q S # T U W X Z # #To fit the 26-letter alphabet into...
Use Python to Complete the following on a single text file and submit your code and...
Use Python to Complete the following on a single text file and submit your code and your output as separate documents. For each problem create the necessary list objects and write code to perform the following examples: Sum all the items in a list. Multiply all the items in a list. Get the largest number from a list. Get the smallest number from a list. Remove duplicates from a list. Check a list is empty or not. Clone or copy...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue = red + 2 * 5 red++; blue = blue + red; cout << blue; 4 points    QUESTION 2 Is the following statement true or false? The Boolean expression in the following if statement will be true for all values of x in the range from 10 to 20 (including the endpoints) and false for all other values: int x; if (x >=...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT