reset password
Author Message
ptran6
Posts: 25
Posted 21:33 Dec 06, 2010 |

Dr. Sun, the Extendable Hash Index example in your slides uses binary keys (e.g. 1011). Meanwhile, the example in the sample final uses decimal keys (e.g. 15). So if we are given decimal keys on the final, then would we need to convert them into binary first, before we insert them into the index? I ask also because you talk about "rightmost bits" in your slides, rather than "rightmost digits".

Also, it seems like we don't use the hash function at all when we insert keys into the Extendable Hash Index. For example, in your slides, you gave us the hash function K % 2^4, but we don't use it. We use the bucket directory instead. So how does the hash function fit in here?

cysun
Posts: 2935
Posted 21:42 Dec 06, 2010 |

The way hash index works is that you first hash the key, and then use the hash value to locate the bucket.

The values in the example we discussed in class are hash values.

The values in the sample final are key values. You need to hash them first, then convert the hash values to binary numbers, and then do the insertion like in the class example.

intregrisist
Posts: 41
Posted 21:49 Dec 06, 2010 |

I don't know if were allowed to post links on here, but this youtube video explained it clearly for me: LNK

Depending on you Global Depth, you use mod 2^g where g is the global depth.  So lets say the global depth is 2, you get the number using 2^2 = 4.  So, lets say you have your Bucket Directory:

Bucket Dir                                   Bucket Block

00

01

11

10                                                        14

Now when you do mod 4 of the decimal you are trying to add you match up the result to the binary number.  EX. 14 mod 4 = 2.  So 14 would go toe the Bucked assigned for binary number 2 (10 = 2).  This is just an example, in reality, you should already have more numbers in your buckets but this is just to show you how to insert a decimal number.

 

Now if your global depth is 3, you do 2^3 = 8.   So, now you do your decimal number mod 8.  and match the result to your bucket directory.

 

Sun, please correct me if I am wrong here.

cysun
Posts: 2935
Posted 22:11 Dec 06, 2010 |
intregrisist wrote:

I don't know if were allowed to post links on here, but this youtube video explained it clearly for me: LNK

,,,

It's correct. It's different from how I explained it in class but the index is the same.