type your search

Wednesday, January 11, 2012

Hash Tables

1)What is the expected time to search for an element in a hash table?

2)What is the worst case time for searching a element using hash table.

3)Demonstrate the insertion of the keys 5,28,19,15,20,33,12,17,10 into a hash table with collisions resolved by chaining.Let the table have 9 slots,and let the hash function be h(k)=k mod 9.

4)Suppose we use a hash function to hash m distinct keys into an array T of length m.Assuming simple uniform hashing,what is the expected number of collisions?

5)Suggest how storage for elements can be allocated and deallocated within the hash table itself by linking all unused slots into a free list.Assume that one slot can store a flag and either one element plus a pointer or two pointers.Does the free list need to be doublt linked,or does a singly linked free list suffice?

6)Suppose we wish to search a linked list of length n,where each element contains a key k along with a hash value h(k).Each key is a long character string.How might we take advantage of the hash values when searching the list for an element with a given key?

3 comments:

  1. Hi Aravind,

    Thanks for highlighting this and indicating about Hash Tables where more study and thought is necessary.

    If I buy a Route 53 domain name, can I create an email address and use it with gmail? If so, how?
    I do not want to use Workmail, or SES or an EC2 instance.
    All I want is a username, password, and SMTP and whatever else is needed to link my route 53 email to gmail.

    The AWS Serverless Application Model (AWS SAM) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.

    Very useful article, if I run into challenges along the way, I will share them here.

    Cheers,
    Kevin

    ReplyDelete
  2. Halo,

    In total awe…. So much respect and gratitude to you folks for pulling off such amazing blogs without missing any points on the Hash Tables Kudos!

    I joined the Amazon affiliate site and received my access key id and my secret key.

    There was a problem downlaoding and saving the secret key so I created another one.

    I am submitting this information to Amazon to complete my affilaite site but Amazon is accepting the information. AWS Training

    I would appreciate any information as to why this may be ocurring.

    I look forward to see your next updates.

    Kind Regards,
    Irene Hynes

    ReplyDelete

  3. Hi Mate,


    Fully agree on Hash Tables. We’re seeing a lot of projects tackle big complex problems but few seem to have taken into consideration and in particular reasons to adopt.

    AWS is a compelling, but overwhelming galaxy of services and features which is constantly expanding. To the uninitiated, it can also be utterly bewildering in terms of how one should 'lego' the various pieces together into solutions in terms of patterns and practices. AWS Training USA






    Great effort, I wish I saw it earlier. Would have saved my day :)


    Obrigado,
    Ajeeth

    ReplyDelete