Hey there! Sign in to join this conversationNew here? Join for free
    • Thread Starter
    Offline

    7
    ReputationRep:
    Hey all, I'm self studying A level computer science, but this is one topic I'm struggling to get my head around, hash tables. Here is the question I am on:

    Q) Using the hashing function k(k+3) mod m, where k is the key field and m is the bucket size, if m is 251, calculate the addresses for the key fields:
    a) 101
    b)52

    Now I understand you substitute the key field into k and 251 into m e.g. for a) 101((101+3) = 104) mod 251
    =10504 mod 251
    But from here I'm not sure on what I'm doing. I've done my best to try to understand the use of modular arithmetic, but I don't know how to do these questions. Can anyone help me out? Thank you in advance (the answers are 213 for a) and 99 for b) btw)
    Offline

    14
    ReputationRep:
    the mod operator shows you the remainder of number you divide. for example: 7 mod 3 = 1 (7-3-3, remainder is 1) or 5 mod 2 = 1(5-2-2, remainder is 1), but 15 mod 3 = 0 (remainder equals 0: 15-3-3-3-3-3).

    in your case, you put the numbers 101 and 53 instead of 'k' and find the remainder by dividing on 251. so its ( 101*(101+3)) mod 251.

    you can also Google any number and find the remainder. just type "number mod number". try to predict the result and then you shall get how it works
    Posted on the TSR App. Download from Apple or Google Play
    • Thread Starter
    Offline

    7
    ReputationRep:
    (Original post by JustVladon)
    the mod operator which shows you the remainder of number you divide. for example: 7 mod 3 = 1 (7-3-3, remainder is 1) or 5 mod 2 = 1(5-2-2, remainder is 1), but 15 mod 3 = 0 (remainder is equals 0: 15-3-3-3-3-3).

    in your case you put the numbers 101 and 53 instead of 'k' and find the remainder by dividing on 251. so its ( 101*(101+3)) mod 251.

    you can also Google any number and find the remainder. just type "number mod number". try to predict the result and the you shall get how it works
    Thank you Vladon, I think I understand the concept better now. Is there a reputation or something I can give to you?
    Offline

    14
    ReputationRep:
    (Original post by AR12)
    Thank you Vladon, I think I understand the concept better now. Is there a reputation or something I can give to you?
    no worries, i dont need anything
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    Have you ever participated in a Secret Santa?
    Help with your A-levels

    All the essentials

    The adventure begins mug

    Student life: what to expect

    What it's really like going to uni

    Rosette

    Essay expert

    Learn to write like a pro with our ultimate essay guide.

    Uni match

    Uni match

    Our tool will help you find the perfect course for you

    Study planner

    Create a study plan

    Get your head around what you need to do and when with the study planner tool.

    Study planner

    Resources by subject

    Everything from mind maps to class notes.

    Hands typing

    Degrees without fees

    Discover more about degree-level apprenticeships.

    A student doing homework

    Study tips from A* students

    Students who got top grades in their A-levels share their secrets

    Study help links and info

    Can you help? Study help unanswered threadsRules and posting guidelines

    Sponsored content:

    HEAR

    HEAR

    Find out how a Higher Education Achievement Report can help you prove your achievements.

    Groups associated with this forum:

    View associated groups
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.