Question

In: Computer Science

Given the following keys: 77, 109, 69, 99, 16, 100, 60 Also given h(k) = k...

Given the following keys: 77, 109, 69, 99, 16, 100, 60 Also given h(k) = k mod m Given size of the Hash Table (m) = 11 a) Find out hash values for each key (k) b) Find out the load factor. c) Construct Hash Table and use Linear Probing to resolve collision.

Solutions

Expert Solution

a)
77 mod 11 = 0
so, hash value of 77 is 0

109 mod 11 = 10
so, hash value of 109 is 10

69 mod 11 = 3
so, hash value of 69 is 3

99 mod 11 = 0
so, hash value of 99 is 0

16 mod 11 = 5
so, hash value of 16 is 5

100 mod 11 = 1
so, hash value of 100 is 1

60 mod 11 = 5
so, hash value of 60 is 5

b)
load factor = number of values / size of table
= 7/11

c)
[77, 109, 69, 99, 16, 100, 60]
Inserting 77
77 mod 11 = 0
77 is inserted at position 0

Number of cells visited during insertion is 1 

Inserting 109
109 mod 11 = 10
109 is inserted at position 10

Number of cells visited during insertion is 1 

Inserting 69
69 mod 11 = 3
69 is inserted at position 3

Number of cells visited during insertion is 1 

Inserting 99
99 mod 11 = 0
There is already an item in 0
So, checking at index 1
99 is inserted at position 1

Number of cells visited during insertion is 2 

Inserting 16
16 mod 11 = 5
16 is inserted at position 5

Number of cells visited during insertion is 1 

Inserting 100
100 mod 11 = 1
There is already an item in 1
So, checking at index 2
100 is inserted at position 2

Number of cells visited during insertion is 2 

Inserting 60
60 mod 11 = 5
There is already an item in 5
So, checking at index 6
60 is inserted at position 6

Number of cells visited during insertion is 2 

HashTable
-----------
0   -      77
1   -      99
2   -      100
3   -      69
4   -     
5   -      16
6   -      60
7   -     
8   -     
9   -     
10      -      109

Related Solutions

2. Given the following keys: 77, 109, 69, 99, 16, 100, 60 Also given h(k) =...
2. Given the following keys: 77, 109, 69, 99, 16, 100, 60 Also given h(k) = k mod m Given size of the Hash Table (m) = 11 For the problem given above, illustrate Double Hashing to resolve the collision. The second has function is: h2(k) = 10 – (k mod 10)
2. Given the following keys: 77, 109, 69, 99, 16, 100, 60 Also given h(k) =...
2. Given the following keys: 77, 109, 69, 99, 16, 100, 60 Also given h(k) = k mod m Given size of the Hash Table (m) = 11 a) Find out hash values for each key (k) b) Find out the load factor. c) Construct Hash Table and use Linear Probing to resolve collision.
Construct a frequency polygon for the following: 60-69   12 70-79   15 80-89    10 90-99      2 100-109...
Construct a frequency polygon for the following: 60-69   12 70-79   15 80-89    10 90-99      2 100-109 1 110-119   0 120-129   1
The test scores of 10 students are listed below. 32, 69, 77, 82, 100, 68, 88,...
The test scores of 10 students are listed below. 32, 69, 77, 82, 100, 68, 88, 95, 75, 80 a. Determine the five-number summary and draw a boxplot for the given data above. Minimum ________ Q1 ________ Median ________ Q3 ________ Maximum b. Is there any outlier? Justify your answer. c. Which of the measures of center would be best to represent the data? Justify your answer
1. The test scores of 10 students are listed below. 32, 69, 77, 82, 100, 68,...
1. The test scores of 10 students are listed below. 32, 69, 77, 82, 100, 68, 88, 95, 75, 80 a. Determine the five-number summary and draw a boxplot for the given data above. Minimum ________    Q1 ________    Median ________    Q3 ________ Maximum ________ b. Which number(s) is suspected outliers? Justify your answer.    c. Is it possible to have a mean of 96 if the scores ranged from 65 to 95? Justify your answer.
given a hash finction H(), and an RSA encrypting algorithm. The public and private keys for...
given a hash finction H(), and an RSA encrypting algorithm. The public and private keys for Alice are PUa, and PRa, respectively. A. Describe how Alice can produce a digital siguature of a message "M. and how Bob can verify the sigature. B. Does the process described in part (a) above provide authentication? Give reason.
97, 147, 115, 135, 105, 78, 68, 100, 102, 117, 146, 77, 127, 87, 137, 109,...
97, 147, 115, 135, 105, 78, 68, 100, 102, 117, 146, 77, 127, 87, 137, 109, 56, 91, 95, 150, 94, 100, 112, 114, 128, 112, 99, 107, 56, 121, 113, 150, 89, 119, 123, 134 Answer the following questions: 1) Calculate the following statistics for the data (original data): a) the mean Tries 0/5 b) the median Tries 0/5 c) the standard deviation Tries 0/5 2) Rescale the original data using the transformation Y=X/14. For the transformed data in...
a) A random sample of 100 housewives shows that 60 prefer detergent A. Compute a 99%...
a) A random sample of 100 housewives shows that 60 prefer detergent A. Compute a 99% confidence interval for the fraction of total housewives favoring detergent A. Give an interpretation of a confidence interval. b) b) A poll of 1000 randomly selected voters was taken to estimate the proportion of population that were in support of the president's current policy on foreign aid. If 555 were favorable, did we find sufficient evidence to support the president's claim that he has...
Consider the following hypothesis test: H 0: u = 16 H a: u ≠ 16 A...
Consider the following hypothesis test: H 0: u = 16 H a: u ≠ 16 A sample of 50 provided a sample mean of 14.13. The population standard deviation is 3. a. Compute the value of the test statistic (to 2 decimals). (If answer is negative, use minus “-“ sign.) b. What is the p-value (to 4 decimals)? c. Using  = .05, can it be concluded that the population mean is not equal to 16? (yes, no) Answer the next three...
Exam 2 scores of the class are given below 80, 52, 69, 78, 34, 67, 99,...
Exam 2 scores of the class are given below 80, 52, 69, 78, 34, 67, 99, 76, 67, 56, 68, 78, 77, 79 What’s the mean? What’s the median? What’s the mode? What’s the variance? What’s the standard deviation? What’s the range? If Jake took a makeup exam and got a 84.8 from this exam, what is his z score? (use the mean and the standard deviation calculated in part a and e). What does this z score tell us...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT