Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 11.4, Problem 2E
Program Plan Intro
To write pseudocode for HASH-DELETE and HASH-INSERT to deal with the special values deleted.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
3.
Double hashing is one of the methods to resolve collision. Write a function to
implement this method. The equations used in this method are given below. Note:
implement everything within the double hash function.
P = (P + INCREMENT(Key)) mod TABLE_SIZE
INCREMENT(Key) = 1 + (Key mod INCR)
TOPIC: hash table with chaining
* For the insert method, we use
table[hash(new_entry)].insert(0, new_entry);
Why do we insert the new entry at position 0 of the list, not at the end of the list?
* When we search for key 100001, the time for each search methods are displayed. Rank the four methods (sequential, binary, hash table 1 and hash table 2) from the slowest to the fastest.
* Explain the ranking of the search methods based on time complexity and load factor (for hashing).
=
Question 3. In the following hash table, we insert elements using hashing with open addressing with quadratic
probing. Elements have as keys integer numbers, and the hash function for the i-th probe is given by hash(x, i)
(x + ²) %11. We insert, in the given order, the elements with the following keys: 46, 58, 57, 39. Indicate, where
these elements will be placed in the table.
index value
0
1
2
3
4
5
6
7
8
9
10
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- a ) How to add 40 on this linear hashing ? b) How to delete 10 on this linear hashing ? please show the results visually NOT WITH CODE. And at the end please write where is the next.arrow_forwardGiven hash_function( ) defined in the default template, complete the main function that does the following tasks: Create a list called hash_list that contains the five hashing algorithm names described above. Read from the user a password to hash. Declare a salt variable and initialize the variable to the hex representation of 4458585599393. Hint: Use function hex(). Use a for loop to iterate over the hash_list and call the hash_function() with the hashing algorithm names in the list. Store the returned value of hash_function() in a variable and output the algorithm name used and the hashed password. Note: Output a new line after each hashed password is printed. If the input is: secretPass the output is: Testing hash algorithm: md5 Hashed Password = bd19f99253c948637d64a4acbd524047:0x40e18692da1 Testing hash algorithm: sha1…arrow_forwardThe hash table array has capacity of 10. Capacity is the number of slots present in the array that is used to build the hashtable. The hash function returns the absolute value of the key mod the capacity of the hash table. a) Insert these keys in the hash table: 3,23,11,21,1,7,77,8 where the hash table uses quadratic probing to resolve collisions. b) Search and Delete 3 and 11 from the table. Be careful about changing the status of the table slot to “deleted” after deleting each item. c)Search 23 and 21 from the table and print their position.arrow_forward
- What is the difference between Hash table and Array list?arrow_forward60. The field on which the equality condition is placed is hashing technique is called a. hash field b. cluster filed c. spanned field d. sequential fieldarrow_forwardwhich index is also reffered to as a non-clustering index? a) Bidirectional Index b) Primary Index c) Hash Index d) Secondary Indexarrow_forward
- in c++ Create a student hash table that contains information, studentID (int), name (string), marks_oop345 (float). The size of hash table is equal to the number of students in the class. Use linear probing in case of collisions. Perform insertion, deletion, display and search operations.arrow_forwardimport hashlib def hash_function(password, salt, al): if al == 'md5': #md5 hash = hashlib.md5(salt.encode() + password.encode()) hash.update(password.encode('utf-8')) return hash.hexdigest() + ':' + salt elif (al == 'sha1'): #sha1 hash = hashlib.sha1() hash.update(password.encode('utf-8')) return hash.hexdigest() + ':' + salt elif al == 'sha224': #sha224 hash = hashlib.sha224() hash.update(password.encode('utf-8')) return hash.hexdigest() + ':' + salt elif al == 'sha256': #sha256 hash = hashlib.sha256() hash.update(password.encode('utf-8')) return hash.hexdigest() + ':' + salt elif al == 'blake2b': #blake2b512 hash = hashlib.blake2b() hash.update(password.encode('utf-8')) return hash.hexdigest() + ':' + salt else: print("Error: No Algorithm!") if __name__ == "__main__": # TODO: create a list called hash_list that contains # the five hashing algorithsm as strings # md5, sha1, sha224, sha256, blake2b hash_list =…arrow_forwardThe putIfAbsent function in HashMap seems useless.arrow_forward
- The following hash map method should be named what?arrow_forward2. Implement the hash table for the following elements: a. 22,32,45,67,89,9 Use Double hashing technique to handle the collision. [ hash1(key)=key%10, hash2(key)=PRIME- (key%PRIME) ].arrow_forwardWe may utilise two methods without implementing them: countand unambiguous The DictionaryEntry object's count is returned via the Count method. whereas Clear removes all DictionaryEntry from the inner hash tableitems from the internal hash tableWrite a program that utilizes these methods:arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education