Question

In: Computer Science

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.

Solutions

Expert Solution

2)
a)
Hash value of 77 is 0
Hash value of 109 is 10
Hash value of 69 is 3
Hash value of 99 is 0
Hash value of 16 is 5
Hash value of 100 is 1
Hash value of 60 is 5

b)
load factor = 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)
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.
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
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...
A pump curve provided by a manufacturer is given by h= 20[1 − (Q/100)2] where h...
A pump curve provided by a manufacturer is given by h= 20[1 − (Q/100)2] where h is the head provided by the pump in meters and Q is the discharge in liters per minute. The system curve for a pumping application is h= 5+0.002Q2 (Q in liters per minute).Find the Operating point (Q) for one pump two pumps connected in series two pumps connected in parallel
Given the following u-k relationship, u = 30 ln (300/k) mi/h. Find the jam concentration, the...
Given the following u-k relationship, u = 30 ln (300/k) mi/h. Find the jam concentration, the capacity of the roadway, and the speed of the shock wave between conditions ua = 60 mi/h and ub = 40 mi/h. Please write out the equations used before plugging in the numbers. Thanks!
Consider the following time series: Quarter Year 1 Year 2 Year 3 1 69 66 60...
Consider the following time series: Quarter Year 1 Year 2 Year 3 1 69 66 60 2 45 37 47 3 55 57 50 4 83 86 77 (a) Choose a time series plot. (i) (ii) (iii) (iv) - Select your answer -Graph (i)Graph (ii)Graph (iii)Graph (iv)Item 1 What type of pattern exists in the data? Is there an indication of a seasonal pattern? - Select your answer -Positive trend pattern, no seasonalityHorizontal pattern, no seasonalityNegative trend pattern, no seasonalityPositive...
Multiple Choice: 1. Suppose the firm's production process is given by Q = 2K^(1/2)*​L. If K=16...
Multiple Choice: 1. Suppose the firm's production process is given by Q = 2K^(1/2)*​L. If K=16 and L=8 what is the marginal productivity of capital? a) 1 b) 2 c) 5 d) 6 e) 8 2. Which of the following is not an assumption we make about perfectly competitive markets? a) Firms are price-takers b) Firms sell identical products c) Firms earn positive profit in the short-run but zero profit in the long-run d) Firms can freely enter or exit...
Multiple Choice: 1. Suppose the firm's production process is given by Q = 2K^(1/2)*​L. If K=16...
Multiple Choice: 1. Suppose the firm's production process is given by Q = 2K^(1/2)*​L. If K=16 and L=8 what is the marginal productivity of capital? a) 1 b) 2 c) 5 d) 6 e) 8 2. Which of the following is not an assumption we make about perfectly competitive markets? a) Firms are price-takers b) Firms sell identical products c) Firms earn positive profit in the short-run but zero profit in the long-run d) Firms can freely enter or exit...
Given reference to SAB 99, post a response to the following: You have discovered 2-3 uncorrected...
Given reference to SAB 99, post a response to the following: You have discovered 2-3 uncorrected misstatements: (1) management has taken the position that the misstatements are not material and (2) the auditor’s argument is that the uncorrected misstatements are material. Which argument is stronger and will carry more weight? Why? How will you decide?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT