
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Like numbers, strings can also be used as keys in a hash functions. A hash function for any string s = “abc” can be defined as:
Hash(abc) = (a + b + c) % tableSize
Consider the following ASCII table for different alphabets and use the hash function to create a hash table of 10 slots for the following Names using Open addressing (Linear probing to resolve collision).
Names: ahmed, samir, saad, yazeed, raed, sultan, salman, azzam, saleh, hamad.
Explain the steps showing your work in detail.
a |
b |
c |
d |
e |
f |
g |
h |
i |
j |
k |
l |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
m |
n |
o |
p |
q |
r |
s |
t |
u |
v |
w |
x |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
y |
z |
||||||||||
121 |
122 |
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps

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
- Use pythonarrow_forwardPYTHON def _insertionsort(self, order): # Implements the insertion sort algorithm to sort a list of items in ascending or descending order n = len(self.items) for i in range(1, n): key = self.items[i] j = i - 1 if order == 'asc': while j >= 0 and key < self.items[j]: self.items[j + 1] = self.items[j] j -= 1 self.items[j + 1] = key elif order == 'desc': while j >= 0 and key > self.items[j]: self.items[j + 1] = self.items[j] j -= 1 self.items[j + 1] = key def sort(self, order = 'asc', type = 'insertion'): if type == 'insertion': # call the insertions sort method to sort atos array based on the parameter values #######################################################################arrow_forwardThe best case behaviour occurs for quick sort when the partition function splits the sequence of size n into subarrays of size: Select one: a.n/4 : 3n/4 b.n/4 : 3n/2 c.3n/8 : (5n/8) d.n/2 : (n/2)-1 e.n/2 : n/3arrow_forward
- Given two arrays of integers, write a function to find the intersection of the arrays. The intersection should include only distinct elements and the result should be in sorted order. Solve this problem using the hash set approach.arrow_forwardcreate a python program Problem StatementImplement all the functions of a dictionary (ADT) using hashing.Data: • Set of (key, value) pairs. Keys are mapped to values. Keys must be comparable. Keys must be unique.Standard Operations: • Insert(key, value) • Find(key), • Delete(key) This is the example output of the program. ====== CPE 204L Dictionary =====[1] : Insert Word[2] : Find Word[3] : Delete Word[4] : Exit============================Enter your choice : 1Enter word: prettyEnter meaning: beautifulPretty is successfully inserted into dictionary====== CPE 204L Dictionary =====[1] : Insert Word[2] : Find Word[3] : Delete Word[4] : Exit============================Enter your choice : 1Enter word: prettyEnter meaning: beautifulDuplicate Word! Pretty is not successfully inserted into dictionary.====== CPE 204L Dictionary =====[1] : Insert Word[2] : Find Word[3] : Delete Word[4] : Exit============================Enter your choice : 2Enter word: prettyWord is Present in…arrow_forwardWrite a C++ program that: (1) defines and implements a hash class that constructs a 15 element array (may be implemented using a vector, a deque, or a list, if you prefer), storing strings, using the following hash function: ((first_letter) + (second_letter) + (last_letter))% 15 (2) the driver program should: a. query the user for ten words and store them using the hash technique described above. b. print out the contents of each position of the array (or vector, deque, or whatever you used), showing vacant as well as filled positions. Remember, only 10 of the 15 positions will be filled. c. repeatedly query the user for a target word, hash the word, check for its inclusion in the list of stored words, and report the result. Continue doing this task until the user signals to stop (establish a sentinel condition).arrow_forward
- Trace counting sort on the following list L of unordered keys which lie withinthe range [10, 18].L[1:10]: 16 11 18 13 11 12 15 15 18 16arrow_forwardYou are given a collection of N non-empty strings, denoted by S₁, S₂,..., Sn. Then you are given N-1 operations which you execute in the order they are given. The įth operation is has the following format: 'a b' (1-based indexing, without the quotes), which means that you have to make the following changes: 1. Sa = Sa+ Sb, i.e. concatenate ath string and 6th string and store the result in ath string, 2. S = "", i.e. make the 6th string empty, after doing the previous step. You are ensured that after the ith operation, there will be no future operation that will be accessing S. Given these operations to join strings, print the last string that will remain at the end of this process. Input The first line contains an integer N (1 ≤N≤ 105) denoting the number of strings given. Each of the next N lines contains a string denoting the S₁. All the characters in the string S, are lowercase alphabets from 'a' to 'z'. The total number of characters over all the strings is at most 106, i.e Σ₁|S₁|…arrow_forwardWrite the generic steps that you will undertake to compute the product of two numbers with 4 digits using Strassen’s algorithm. The 4 digit numbers are A0A1A2A3 and B0B1B2B3. Then compute using Strassen algorithm the product of 27 and 19.arrow_forward
- Select all explicit instructions that apply to the following prompt: Implement an open addressing hash table to store a list of integers. Your task is to handle collisions using open addressing and implement basic operations such as insertion, deletion, and searching. The open addressing technique you will use is linear probing.arrow_forwardConsider a hash table of capacity 5 that uses open addressing with linear probing. This hash table uses a hash function that takes the remainder when the hash code of a string is divided by the capacity of the hash table. (For example, "air" hashes 0.) The hashCode method has been overridden for strings, which simply returns 0 if a string begins with 'a', 1 if it begins with 'b', etc. /** Returns 0 if a String begins with 'a', 1 if it begins with 'b', etc. */ public int hashCode() { return this.charAt(0) - 'a'; } Assume that "apple", and "butter" have been inserted in this order into the hash table. "fig" is to be inserted into the hash table. (a) Which array slot/index should "fig" be placed? Answer: (b) What is the load factor after "fig" is inserted into the hash table? Answer:arrow_forwardIn §12.2 Lamport's Hash we mentioned the notion of using only 64 bits of the hash. At each stage, 128 bits are computed, 64 bits are thrown away, and the hash of the retained 64 bits is used in the next stage. The purpose of only using 64 bits is so that a human does not need to type as long a string. Assuming the person will still only type 64 bits, does it work if hashn does a hash of all 128 bits of hashn-1, but what the person actually transmits is 64 bits of the result?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