A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

umm well a string of three characters ( T,C,G,A) , from among these, will be given to the hash function which will generate an index. Can i simply do something like this, if the input is TTT index is 0 , if TCT , index is 1 and so on

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    int findIndex ( char *arr ) { int sum , x , i , b , z ; i = 0; int y = strlen(arr); x = arr[0]; x = (x*x)%10; b = arr[1]; z = arr[2]; z = (z*z); sum = x-b+z; return (sum%64); }

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I have this hash function , it gives 20 collissions . Is this a correct hash function ? Also how can i make it a perfect hash function

  3. myininaya
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    omg i don't know this much about hash functions i only really know about the math behind it i;m sorry :(

  4. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    :( its ok :)

  5. shadowfiend
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    How much capacity will your hashtable have? That will decide whether you will find it possible to have a perfect hash function or not.

  6. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    hash table can be of 128 size at maximum

  7. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I imagine there are different implementations of hash. You will have some collisions depending on the number of different inputs you have. Although you can build your own hash functions as you describe above, the built in implementations are likely to be more efficient and set up so that the compiler can optimize them better than probably anything you would write. If your task is not specifically to build a hash implementation, I would go with the built in class(es).

  8. shadowfiend
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    Ok, if the table can be 128 size maximum, 4 letters 3 at a time gives you a maximum of 24 permutations, so you know you can find a perfect hash function. You need to basically figure out a way that each possible string can be assigned a number from 0 to 24, and then any hashtable size above 23 will have a perfect hash function for it.

  9. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks alot everyone! :)

  10. shadowfiend
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    You're welcome :)

  11. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.