Question
please help fast, this is for practice

will not upvote if you take too long

For the input 49, 20, 56, 75, 89, 87, 65 and hash function h(k)=k mod 11, construct the closed hash table using linear probin
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hash Table :

It is a data Structure which stores the data in Associated manner based on the Index value generated by the Hash function(It is a mathematical function which returns any index position in the Hash table).

If the index position generated by the Hash Function is already occupied with some other then it is called Collision Then we follow some collision resolution techniques like linear probing

Linear Probing: It is one of the collision resolution technique in which we place the value in the next Empty position of the Hash table whenever a Collision Occurs.

Given Input Keys: 49,20,56,75,89,87,65

Hash Function: k mod 11 (key_value %11)
Collision Resolution: Linear Probing

Step 1: Inserting 49

  • Hash position = 49 % 11 = 5
  • Attempting to insert 49 at position 5.(Empty)
  • Inserting 49 at position 5.

0 3 5 49 6 7 2 9 10

Step 2: Inserting 20

  • Hash position = 20 % 11 = 9
  • Attempting to insert 20 at position 9.(Empty)
  • Inserting 20 at position 9.

0 نيا 5 49 8 9 20 10

Step 3: Inserting 56

  • Hash position = 56 % 11 = 1
  • Attempting to insert 56 at position 1.(Empty)
  • Inserting 56 at position 1.

0 56 1 2 3 4 5 49 6 7 8 9 20 10

Step 4: Inserting 75

  • Hash position = 75 % 11 = 9
  • Attempting to insert 75 at position 9.(occupied So Collision)
  • Attempting to insert 75 at next adjacent position 10.(Empty)
  • Inserting 75 at position 10.

0 1 1 56 2 نيا 49 8 9 10

Step 5: Inserting 89

  • Hash position = 89 % 11 = 1
  • Attempting to insert 89 at position 1.(occupied So Collision)
  • Attempting to insert 89 at next adjacent position 2.(Empty)
  • Inserting 89 at position 2

0 1 56 2 89 3 4 ת) 49 6 ן 8 9 20 10 75

Step 6: Inserting 87

  • Hash position = 87 % 11 = 10
  • Attempting to insert 87 at position 10.(occupied So Collision)
  • Attempting to insert 87 at next adjacent position 0.(Empty)
  • Inserting 87 at position 0

0 8 3 4 5 49 9 10

Step 7: Inserting 65

  • Hash position = 65 % 11 = 10
  • Attempting to insert 65 at position 10.(occupied So Collision)
  • Attempting to insert 65 at next adjacent position 0.(occupied So Collision)
  • Attempting to insert 65 at next adjacent position 1.(occupied So Collision)
  • Attempting to insert 65 at next adjacent position 2.(occupied So Collision)
  • Attempting to insert 65 at next adjacent position 3.(Empty)
  • Inserting 65 at position 3

.0 27 1 56 2 89 3 ס 4 ת) 49 6 1 8 9 20 10 75

This final Hash table after all 7 insertions into table.

If You Have Any Doubts. Please Ask Using Comments.

Have A Great Day!

Add a comment
Know the answer?
Add Answer to:
please help fast, this is for practice will not upvote if you take too long For...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help for Q11 Please if you can, answer this question too. I need B...

    I need help for Q11 Please if you can, answer this question too. I need B Q11. A complete graph is a graph where all vertices are connected to all other vertices. A Hamiltonian path is a simple path that contains all vertices in the graph. Show that any complete graph with 3 or more vertices has a Hamiltonian path. How many Hamiltonian paths does a complete graph with n vertices has? Justify your answer Q1. Draw thee 13-entry hash...

  • Need help on problems 3 and 4 only thanks in advance. Define the following terms: hash...

    Need help on problems 3 and 4 only thanks in advance. Define the following terms: hash table hash function perfect hash function What is a collision? Explain three ways of handling collisions (a program is not needed; a clear brief explanation suffices). Consider a hashing scheme that uses linear probing to resolve collisions. Design an algorithm (no code necessary) to delete an item from the hash table. What precautions do you need to take to make it work properly? Given...

  • For this question, you need to provide your handwritten answer on the given answer sheet. A....

    For this question, you need to provide your handwritten answer on the given answer sheet. A. Explain the Collision term in a Hash Table. B. Use the following hash function to build a hash table of array size (12) hashFunction(s) s s.toUpperCase(); ( 'A' hash (s. charAt(2) s.charAtC0) ) / 2 - 'A' ) MOD 12 return hash Use the hash function and the table below to build insert the following strings in the hash table using separate hash chaining...

  • JH: Student Name: 4) Given the following array, do the following (show all the work). A...

    JH: Student Name: 4) Given the following array, do the following (show all the work). A (56, 89, 23, 58, 22, 11, 45, 48, 90) (a - 5 pts) Construct a hash table for the given array using the hash function H(K)- K mod 5 (b- 4 pts) Determine the average number of comparisons for a successful search using the hash table of (c -3 pts) What is the worst case number of comparisons for an unsuccessful search in the...

  • Need help understanding and doing this type of problem. Will upvote for clear instructions, please! (parts...

    Need help understanding and doing this type of problem. Will upvote for clear instructions, please! (parts 1-3) Objective: Design a Counter using T Flip-Flops that counts 0, 1, 2, 3, 4, 5, 6, ... Hints: 1) Construct the State Table, consider unused states as don't care conditions. The State Table should include the Present State, Next State, and Inputs to TF-F's. 2) Using K-maps find the simplified Input equations to the TF-F's. 2) Draw the Logic circuit diagram. - Design...

  • Please help with this SQL problem. Thank you. a) A fast-food restaurant has order tickets with nu...

    Please help with this SQL problem. Thank you. a) A fast-food restaurant has order tickets with numbers that are sequentially assigned, with numbers like the ones below, which were somehow chosen from several months’ worth of daily sales. (Perhaps by searching for meals eaten by Joe Blow.) The restaurant has a funny little computer system that has 100 memory locations for hash destinations. The software uses a simple “modulo 100” hashing formula. Which ticket numbers below, if any, will create...

  • Please Answer the following: 4. 5. >> How long would each of these operations take in...

    Please Answer the following: 4. 5. >> How long would each of these operations take in Big O notation? 4.5 Printing the value of each element in an array. 4.6 Doubling the value of each element in an array. 4.7 Doubling the value of just the first element in an array. 4.8 Creating a multiplication table with all the elements in the array. So if your array is [2, 3,7, 8, 10], you first multiply every element by 2, then...

  • Consider the below matrixA, which you can copy and paste directly into Matlab.

    Problem #1: Consider the below matrix A, which you can copy and paste directly into Matlab. The matrix contains 3 columns. The first column consists of Test #1 marks, the second column is Test # 2 marks, and the third column is final exam marks for a large linear algebra course. Each row represents a particular student.A = [36 45 75 81 59 73 77 73 73 65 72 78 65 55 83 73 57 78 84 31 60 83...

  • Please show how you did this in excel. :13-19 Every home football game for the past...

    Please show how you did this in excel. :13-19 Every home football game for the past eight years at Eastern State University has been sold out. The revenues from ticket sales are significant, but the sale of food, beverages, and souvenirs has contrib- uted greatly to the overall profitability of the football program. One particular souvenir is the football pro- gram for each game. The number of programs sold at each game is described by the following probabil- ity distribution:...

  • Could you please help with this. I will upvote the response. Problem: A 4-speed FWD AT...

    Could you please help with this. I will upvote the response. Problem: A 4-speed FWD AT is shown in the sketch. The numbers of teeth for the sun, planet and ring of the two planetary gear trains and of the final drive gears are shown in the sketch. The tire radius is 11 inches. The front projected area is 21ft and the air drag coefficient is 0.30. The roll resistance coefficient is 0.02. The transmission efficiency is 0.86. The vehicle...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT