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
thumb_up100%
Write a code in python, You will implement Hashtable using two techniques: Separate Chaining and Linear Probing.
- Implement Hashtable using Separate Chaining
- Implement hashtable using Linear Probing
- Test your both Hashtable classes with instances of Student class; you can have three (3) data members and appropriate functions, including hash() function.
- Test your both Hashtable classes with instances of Employee class; you can have three (3) data members and appropriate functions, including hash() function.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 2 images
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
- Let's assume that a player plays a multi-agent game where, every gun has a type: "Sidearms" or "Rifles" or "Sniper Rifles". Here, in every dictionary inside the tuple, the key is the gun name, the first index of the dictionary value is the gun type and the second index of the dictionary value is the kills done by that gun in a certain match. Now, write a Python program that will generate a dictionary from the given tuple of dictionaries: ================================================ Given Tuple 1: ({"Ghost" : ["Sidearms", 3]}, {"Vandal" : ["Rifles", 15]}, {"Sheriff" : ["Sidearms", 5]}, {"Operator": ["Sniper Rifles", 7]}, {"Phantom" : ["Rifles", 10]}) Sample Output 1: {"Sidearms" : ["Ghost","Sheriff", 8], "Rifles" : ["Vandal", "Phantom", 25], "Sniper Rifles" : ["Operator", 7]} Explanation1: Here, in the expected dictionary the keys will be the type of the guns and the values for an individual key will have the gun names and the sum of the kills by those guns in a…arrow_forwardModify the generic Pair.java class in two ways: Make it so that both values have the same type Add a method swap that swaps the first and second elements of the pair Examples:Pair<Integer> intPair = new Pair<>(17, 19);intPair.getFirst(); // returns 17intPair.getSecond(); // returns 19intPair.swap();intPair.getFirst(); // returns 19intPair.getSecond(); // returns 17Pair<String> strPair = new Pair<>("Erick", "Valdez");strPair.getFirst(); // returns "Erick"strPair.getSecond(); // returns "Valdez"strPair.swap();strPair.getFirst(); // returns "Valdez"strPair.getSecond(); // returns "Erick" Pair.java /*** This class collects a pair of elements of different types.*/public class Pair<T, S> {private T first;private S second;/*** Constructs a pair containing two given elements.* * @param firstElement the first element* @param secondElement the second element*/public Pair(T firstElement, S secondElement) {first = firstElement;second = secondElement;}/*** Gets…arrow_forwardJava Code: For Lexer.java Make a HashMap of <String, TokenType> in your Lex class. Below is a list of the keywords that you need. Make token types and populate the hash map in your constructor (I would make a helper method that the constructor calls). while, if, do, for, break, continue, else, return, BEGIN, END, print, printf, next, in, delete, getline, exit, nextfile, function Modify “ProcessWord” so that it checks the hash map for known words and makes a token specific to the word with no value if the word is in the hash map, but WORD otherwise. For example, Input: for while hello do Output: FOR WHILE WORD(hello) DO Make a token type for string literals. In Lex, when you encounter a “, call a new method (I called it HandleStringLiteral() ) that reads up through the matching “ and creates a string literal token ( STRINGLITERAL(hello world) ). Be careful of two things: make sure that an empty string literal ( “” ) works and make sure to deal with escaped “ (String quote = “She…arrow_forward
- import java.util.HashSet; import java.util.Set; // Define a class named LinearSearchSet public class LinearSearchSet { // Define a method named linearSearch that takes in a Set and an integer target // as parameters public static boolean linearSearch(Set<Integer> set, int target) { // Iterate over all elements in the Set for () { // Check if the current value is equal to the target if () { // If so, return true } } // If the target was not found, return false } // Define the main method public static void main(String[] args) { // Create a HashSet of integers and populate integer values Set<Integer> numbers = new HashSet<>(); // Define the target to search for numbers.add(3); numbers.add(6); numbers.add(2); numbers.add(9); numbers.add(11); // Call the linearSearch method with the set…arrow_forwardDevelop classes STint and STdouble for maintaining ordered symbol tables where keys are primitive int and double types, respectively. (Convert genericsto primitive types in the code of RedBlackBST.) Test your solution with a version ofSparseVector as a client.arrow_forwardImplement the transaction manager class using java Explain your code in few words. I have included other classes that have relation with the parking transaction calssarrow_forward
- Given the following Java functions, transcribe it into a Python 3 program. /* Each entry stores a (key, value) pair, it's hash value and* a reference to the next entry with the same hash value */class Entry {Object key;Object value;final int hash;Entry next; /*** Create new entry.*/Entry(int h, Object k, Object v, Entry n) {value = v;next = n;key = k;hash = h;}}arrow_forwardimport java.util.HashMap; import java.util.Map; public class LinearSearchMap { // Define a method that takes in a map and a target value as parameters public static boolean linearSearch(Map<String, Integer> map, int target) { // Iterate through each entry in the map for () { // Check if the value of the current entry is equal to the target if () { // If the value is equal to the target, return true } } // If no entry with the target value is found, return false } public static void main(String[] args) { // Create a HashMap of strings and integers Map<String, Integer> numbers = new HashMap<>(); // Populate the HashMap with key-value pairs numbers.put("One", 1); numbers.put("Two", 2); numbers.put("Three", 3); numbers.put("Four", 4); numbers.put("Five", 5); // Set the target value to search for…arrow_forwardJava Code: Create a Parser class. Much like the Lexer, it has a constructor that accepts a LinkedList of Token and creates a TokenManager that is a private member. The next thing that we will build is a helper method – boolean AcceptSeperators(). One thing that is always tricky in parsing languages is that people can put empty lines anywhere they want in their code. Since the parser expects specific tokens in specific places, it happens frequently that we want to say, “there HAS to be a “;” or a new line, but there can be more than one”. That’s what this function does – it accepts any number of separators (newline or semi-colon) and returns true if it finds at least one. Create a Parse method that returns a ProgramNode. While there are more tokens in the TokenManager, it should loop calling two other methods – ParseFunction() and ParseAction(). If neither one is true, it should throw an exception. bool ParseFunction(ProgramNode) bool ParseAction(ProgramNode) -Creates ProgramNode,…arrow_forward
- In this project, you will implement a Set class that represents a general collection of values. For this assignment, a set is generally defined as a list of values that are sorted and does not contain any duplicate values. More specifically, a set shall contain no pair of elements e1 and e2 such that e1.equals(e2) and no null elements. (in java)Requirements among all implementations there are some requirements that all implementations must maintain. • Your implementation should always reflect the definition of a set. • For simplicity, your set will be used to store Integer objects. • An ArrayList<Integer> object must be used to represent the set. • All methods that have an object parameter must be able to handle an input of null. • Methods such as Collections. the sort that automatically sorts a list may not be used. Instead, when a successful addition of an element to the Set is done, you can ensure that the elements inside the ArrayList<Integer>…arrow_forwardHelp with this java question: Map<KeyType, ValueType> mapName = new HashMap<>();arrow_forwardTask on Hashing Given an array containing Strings, you need to write a code to store them in a hashtable. Assume that the Strings contain a combination of capital letters and numbers, and the String array will contain no more than 9 values.Use the hash function to be the (total number of consonants*24 + summation of the digits) %9. In case of a collision, use linear probing. For a String "ST1E89B8A32", it's hash function will produce the value=(3*24+(1+8+9+8+3+2))%9=4, hence it will be stored in index 4 of the hash table.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