0% found this document useful (0 votes)
48 views1 page

Tutorial Sheet-4 (Functions)

1) The document describes a hashing function that assigns surnames to storage locations using a 4-step process: replacing letters with numbers, multiplying by position value, adding letter values, and taking the remainder of division by 63 storage locations. It provides examples applying this hashing function to several surnames. 2) It asks to prove that if T(n) = 15n^3 + n^2 + 4, then T(n) is O(n^4). 3) It also asks to prove that if T(n) = 15n^3 + n^2 + 4, then T(n) is Ω(n^2).

Uploaded by

Jashd Deep
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views1 page

Tutorial Sheet-4 (Functions)

1) The document describes a hashing function that assigns surnames to storage locations using a 4-step process: replacing letters with numbers, multiplying by position value, adding letter values, and taking the remainder of division by 63 storage locations. It provides examples applying this hashing function to several surnames. 2) It asks to prove that if T(n) = 15n^3 + n^2 + 4, then T(n) is O(n^4). 3) It also asks to prove that if T(n) = 15n^3 + n^2 + 4, then T(n) is Ω(n^2).

Uploaded by

Jashd Deep
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

UCS405 (Discrete Mathematical Structures)

Tutorial Sheet-4 (Functions)

1. Define a hashing function that uses 63 storage locations as a four-stage process with surnames
as input. The first step is to replace the letters of the surname with integers according to the
following rule: A → 1, B → 2, C → 3 ..., Y→25, Z →26. The second step is to multiply the
letter value by 2i where i is the letter's position in the word, with the leftmost character being
in position 1. The third step is to add the values that represent the letters of the surname. The
final step is to divide this sum by 63. The hashing value is the remainder of this division. For
example, Robb has a value of 144 and a hashing value of 18. You should imagine that the
information needed for Robb is in storage location 18. Carry out this hashing procedure for
Smith, Jones, Brown, Zento, and Ruster.

2. Prove that if T(n) = 15n3 + n2 + 4, T(n) = O(n4).

3. Prove that if T(n) = 15n3 + n2 + 4, T(n) = Ω(n2).

4. Prove that n2 + 5n + 7 = Θ(n2).

5. A parking lot has 31 visitor spaces, numbered from 0 to 30. Visitors are assigned parking
spaces using the hashing function h(k) = k mod 31, where k is the number formed from the
first three digits on visitor's license plate.

a) Which spaces are assigned by the hashing function to cars that have these first three digits
on their license plates? 317, 918,007, 110, 111, 310.

b) What can you advise the visitors when the space they are assigned is occupied?

6. Give as good a big-O estimate as possible for the function: 𝑛! 2 𝑛 log 𝑛 1

You might also like