In open addressing, why do we need a table size that’s at least the number of keys? State how much larger it should be, to get an efficient time complexity.
Open Addressing
Open addressing is a method for handling collisions. In Open
Addressing, all elements are stored in the hash table itself. So at
any point, size of the table must be greater than or equal to the
total number of keys.
Insert(k): Keep probing until an empty slot is found. Once an empty slot is found, insert k.
Search(k): Keep probing until slot’s key doesn’t become equal to k or an empty slot is reached.
Delete(k): Delete operation is
interesting. If we simply delete a key, then search
may fail. So slots of deleted keys are marked specially as
“deleted”.
Insert can insert an item in a deleted slot, but the search doesn’t
stop at a deleted slot.
Performance of Open Addressing:
Like Chaining, the performance of hashing can be evaluated under
the assumption that each key is equally likely to be hashed to any
slot of the table (simple uniform hashing)
m = Number of slots in the hash table n = Number of keys to be inserted in the hash table Load factor α = n/m ( < 1 ) Expected time to search/insert/delete < 1/(1 - α) So Search, Insert and Delete take (1/(1 - α)) time
--> So, to make it efficient α should be zero, Hence m should be high.
In open addressing, why do we need a table size that’s at least the number of...
Question 8: (a) We create a Hash Table of size 7, using open addressing and linear probing with the hash function h(n)=n%7. Write the content of the array after inserting the following values in sequence: 11, 28,46, 7,67, 88,0. (3 marks) . loj [1] [2] [3] [41-5] 问 (b) Explain the issue linear probing has and how it can be addressed. (3 marks)
3. (20 points) In open addressing with double hashing, we have h(k,i) hi(k)+ih2(k) mod m, where hi(k) and h2(k) is an auxiliary functions. In class we saw that h2(k) and m should not have any common divisors (other than 1). Explain what can go wrong if h2(k) and m have a common divisor. In particular, consider following scenario: m- 16, h(k) k mod (m/8) and h2(k)-m/2 and the keys are ranged from 0 to 15. Using this hash function, can...
i am writing thesis paper for these question (why do we need data structures? What is the relationship between data structure and algorithm? What data structures have we learned? What are their respective logical and physical / storage structures? What are their advantages and disadvantages? In which cases do they apply to (combined with time complexity analysis)? Please analyze the learned data structure one by one. At least one application example combining data structure and algorithm should be given) i...
Implement a StringHash class using python using open addressing and linear probing, it should contain the following methods: Using strings for the data 1. StringHash(size) — create a new hashTable with a default size of 11 for your array, but allow the user to specify an alternate size if desired 2. addItem(string) — place value into the hashTable iv. bool PindItem(string value) — return true if the value is present, else false 3. findItem(string value) — return true if the...
Earlier in the class we discussed how a Meet in the Middle attack made double-DES (encrypting something twice in a row with two separate keys of DES) not nearly as secure as we might think. This came at the cost of storing many possible decryptions in a table. For this question I want you to calculate how much storage space it would take to store the information necessary to do a meet in the middle attack on double-AES (of 128...
I need a response to the discussion below. Why do we need laws such a natural process as Breast feeding? What do these laws Reflect about our nation? Part one: Section 7 of the fair labor standards act of 1938 ( 29 U.S.C 207) is Amended by adding at the end the following. Employer shall provide- reasonable break time for an employee to express breast milk for her nursing child for a year after the Child’s birth. A place other...
Run JFlap, and use File->Open to open the problem1.jff file that we have given you. In problem1.jff, build a deterministic finite-state machine that accepts all bit strings containing at least three 1s and at most one 0, and that rejects all other bit strings. This problem requires at least nine states. You may use more states if necessary (there’s no penalty for doing so), but if you have time, try to get as close to the minimum as possible! Here...
1.Why do we use to 37C bath? 2. What happens if the temperature is too high? 3. For each macromolecule, why do we use on tube with and enzyme and one without? 4.Why do we use on tube with just an enzyme and no substrate? 5. Why may pancreatic lipase not have much effect on digesting milk fat? What else do we need to make the digestion of fats more efficient?
4. Hashing and Hash Tables. You need to use the ASCII table in the last page for this question. Study the following hash functions for ASCII C strings that are at least 3-char long unsigned hash1(const char, unsigned unsigned vto]+01997 return (v % m); unsigned hash2Cconst char unsigned) unsigned v-o]k(2] 877 return 1 + (v % ( -1)); (a) Given that m-, 7, compute the hash values and fill the following table (3%) String k hash1k, ) hash2(k, 7) aph...
i need an conclusion for my research thesis paper and my research paper covered these areas(why do we need data structures? What is the relationship between data structure and algorithm? What data structures have we learned? What are their respective logical and physical / storage structures? What are their advantages and disadvantages? In which cases do they apply to (combined with time complexity analysis)? Please analyze the learned data structure one by one. At least one application example combining data...