1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
baherus [9]
2 years ago
12

Show the array that results from the following sequence of key insertions using a hashing system under the given conditions: 5,

205, 406, 5205, 8205, 307 (you can simply list the non-null array slots and their contents)
a. array size is 100, linear probing used.
b. array size is 100, quadratic probing used.
Computers and Technology
1 answer:
sergejj [24]2 years ago
3 0

Answer:

a) Linear probing is one of the hashing technique in which we insert values into the hash table indexes based on hash value.

Hash value of key can be calculated as :

H(key) = key % size ;

Here H(key) is the index where the value of key is stored in hash table.

----------

Given,

Keys to be inserted are : 5 , 205, 406,5205, 8205 ,307

and size of the array : 100.

First key to be inserted is : 5

So, H(5) = 5%100 = 5,

So, key 5 is inserted at 5th index of hash table.

-----

Next key to inserted is : 205

So, H(205) = 205%100 = 5 (here collision happens)

Recompute hash value as follows:

H(key) =(key+i) % size here i= 1,2,3...

So, H(205) =( 205+1)%100 = 206%100 = 6

So, key 205 is inserted in the 6th index of the hash table.

----------

Next Key to be inserted : 406

H(406) = 406%100 = 6(collision occurs)

H(406) =(406+1) %100 = 407%100 = 7

So, the value 406 is inserted in 7the index of the hash table.

-----------------

Next key : 5205

H(5205) = 5205%100 = 5(collision)

So, H(5205) = (5205+1)%100 = 6( again collision)

So, H(5205) = 5205+2)%100 = 7(again collision)

So, H(5205) = (5205+3)%100 = 8 ( no collision)

So, value 5205 is inserted at 8th index of the hash table.

-------------

Similarly 8205 is inserted at 9th index of the hash table because , we have collisions from 5th to 8th indexes.

-------------

Next key value is : 307

H(307) = 307%100 = 7(collision)

So, (307+3)%100 = 310%100 = 10(no collision)  

So, 307 is inserted at 10th index of the hash table.

So, hash table will look like this:

Key       index

5         5

205         6

406         7

5205 8

8205 9

307         10

b) Quadratic probing:

Quadratic probing is also similar to linear probing but the difference is in collision resolution. In linear probing in case of collision we use : H(key) = (key+i)%size but here we use H(key) =( key+i^2)%size.

Applying Quadratic probing on above keys:.

First key to be inserted : 5.

5 will go to index 5 of the hash table.

-------

Next key = 205 .

H(205) = 205%100 = 5(collision)

So. H(key)= (205+1^2)%100 = 6(no collision)

So, 205 is inserted into 6th index of the hash table.

--------

Next key to be inserted 406:

So, 406 %100 = 6 (collision)

(406+1^2)%100 = 7(no collision)

So, 406 is moved to 7th index of the hash table.

----------

Next key is : 5205

So, 5205%100 = 5 (collision)

So, (5205+1^2)%100 = 6 ( again collision)

So, (5205+2^2)%100 = 9 ( no collision)

So, 5205 inserted into 9th index of hash table.

-----------

Next key is 8205:

Here collision happens at 5the , 6the , 9th indexes,

So H(8205) = (8205+4^2)%100 = 8221%100 = 21

So, value 8205 is inserted in 21st index of hash table.

--------

Next value is 307.

Here there is collision at 7the index.

So, H(307) = (307+1^2)%100 = 308%100= 8.

So, 307 is inserted at 8the index of the hash table.

Key           Index

5                  5

205                  6

406                  7

5205                9

8205               21

307                   8

You might be interested in
When a person visits a web site, his or her ip address and the links he or she clicked on are automatically recorded. this is an
allochka39001 [22]
B. Invisible information gathering.
8 0
3 years ago
Describe the procedure for creating a table or spreadsheet in a presentation slide.
vodomira [7]

Answer:

Select the slide that you want to insert a table on.On the Insert tab, in the Tables group, click Table, and then click Excel Spreadsheet.To add text to a table cell, click the cell, and then enter your text

Explanation:

7 0
2 years ago
Read 2 more answers
In Python write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs
Lilit [14]

Answer:

ansList =input().split() #get input and split it by space

ansList = [int(i) for i in ansList if int(i)>0] #turn string to integer,and get all positive integers

print(ansList)

Explanation: I think this would work for you. I leace comments in the answer.

3 0
1 year ago
REEEEEEE I STILL NEED MORE AESTHETIC USERNAMES TO GO OFF OF PWEASE HELP IMA HAVE A PANIC ATTACK!!!... next post ima do a vote :&
aev [14]

StrawberryTeaa (could be any fruit: blueberry, peach, etc)

potatoxchip

pastelsquid

SquishyPeach

GummiBear

ElegantFlaws (could add an e and remove the s: EleganteFlaw)

hunnie_b (or honee, honnie, hunni, etc)

agonyisheree

It's cool if you don't like these. I had trouble when I changed my user too. But you'll find your perfect username eventually. :)

7 0
2 years ago
When you log into quickbooks online account whose books can you directly access and manage?
MArishka [77]

Answer: your books and the ones you are given access to.

Explanation: quickbooks goes from day to day bookkeeping to month and year end financial reports and tax filing. businesses use to manage daily sales and expenses and also keep track of daily transactions. They can involve or outsource bookkeepers or choose to run in-house operations. In doing this they would have access to all their books or decide to give virtual access to their outsourced bookkeeper/accountant. Quickbooks has multiple features concerning user access and privacy. A quick books user, in this case the business, can restrict access for each user it decides to add. The user can decide to give free access to all books or decide to restrict to a few files. Example, the business may add an accountant as one of its users and decide to restrict the accountant to its payroll files, depending on the agreement.

3 0
3 years ago
Other questions:
  • This is tech question related to mobile and PC.
    6·1 answer
  • Mary, Tim, John, and Jenn each sold three million dollars worth of product within six months. Each month one of them was awarded
    12·2 answers
  • What are the two types of digital water marking?
    5·1 answer
  • Which service risks our every move and routine being tracked?
    13·1 answer
  • When targeting customers of the consumer population at market a product, what type of segmentation information would be most hel
    12·2 answers
  • Que es la papirofobia​
    13·2 answers
  • How many digits are in the binary number system? Explain why.
    11·2 answers
  • click attachment to see correct answer. Which agencies run the Landsat Program? The Landsat program is run by ___ and ___.​
    11·1 answer
  • Print("Weight on Earth?")
    13·1 answer
  • When adding a component to a container with the ____ layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!