Please Answer the following:
4.

5.

>>

4)
4.5)
Complexity : O(n)//where n is the number of elements in array
explanation:
to access each element inorder to print takes
O(1)//constant time
now, array contains n elements,so n*1 =
O(n)times
4.6)
Complexity : O(n)//where n is the number of elements in array
explanation:
to access each element inorder to double takes
O(1)//constant time
now, array contains n elements,so n*1 =
O(n)times
4.7)
Complexity : O(1)
explanation:
to access first element inorder to double takes
O(1)//constant time
4.6)
Complexity : O(n^2)//where n is the number of elements in
array
explanation:
to access each element inorder to double takes
O(1)//constant time
now, for each element we will perform n
multiplications so
total n*n = n^2 =O(n^2)
Please Answer the following: 4. 5. >> How long would each of these operations take in...
Please answer the following
5.1
5.2
5.3
5.4
It's important for hash functions to consistently return the same output for the same input. If they don't, you won't be able to find your item after you put it in the hash table! Which of these hash functions are consistent? 5.1 f(x) -1 < 5.2 f (x) rand) < 5.3 f(x)- next_empty_slot () 5.4 f(x) 1en (x) < Uses the length of the Returns "1" for all input Returns a random...
Please complete the following task: Create a C++ hash table program for generating a hash from a string. Create a hash function then test and evaluate the results. The set of strings are from a "words.txt" file (there are 45,402 words in the file, no repeating words. Map the words to 45,402 buckets using a hash function). Requirements: Create an array of 45,402 integers and initialize each to zero. These will be used to store how many times each index...
Following class is only part of my program that uses a hash table to simulate a market's client database, client class is my main class which asks user to input client names and then creates a hash table which then users can look up client names. wasn't able to upload everything as it is too much code, but what I need is to modify my client class instead of me inputting data line by line, the program should read from...
Insert elements into a hash table implemented using chain hashing, as an array of linked list in which each entry slot is as a linked list of key/value pairings that have the same hash (outcome value computed using certain hash function). You are allowed to use “Hash Function”, h(k) = k % x where, x is the value you will need to decide to use, that you find appropriate for this implementation. The main requirements are the following: 1. Input:...
In this project, the students will finish three functions that are described in Programming Project 4 (on page 536) and Programming Project 6 (on page 358). The student will also implement the main function and a print function to test these three functions. Please notice, there is a video notes for the solution of Project 6. However, your main function shall have more test than what in video notes. The student may start with the attached code. Please rename the...
Lab 2: (one task for Program 5): Declare an array of C-strings to hold course names, and read in course names from an input file. Then do the output to show each course name that was read in. See Chapter 8 section on "C-Strings", and the section "Arrays of Strings and C-strings", which gives an example related to this lab. Declare the array for course names as a 2-D char array: char courseNames[10] [ 50]; -each row will be a...
Explain each answer.
Select the correct option for the following multiple choice questions or provide short answers accordingly: 1. Consider a hash table with chaining, of size N. Assume in each of the following scenarios the table starts empty. Further assume K pairs of <key, element> are added and K N Then, in which of the following situations will a find operation for a particular key have a potential worst-case runtime of O(N) a) The keys of all elements are...
C++ problem with dynamic arrays is that once the array is created using the new operator the size cannot be changed. For example, you might want to add or delete entries from the array similar to the behavior of a vector. This project asks you to create a class called DynamicStringArray that includes member functions that allow it to emulate the behavior of a vector of strings. The class should have: A private member variable called dynamicArray that references a...
Java Code please read comments and add the code to required lines....LINE 1 to LINE 5 ********************************************************************** * Program Summary: This program demonstrates these basic Java concepts: * - Creating an array based on user input * - Accessing and displaying elements of the array * * The program should declare an array to hold 10 integers. * The program should then ask the user for an integer. * The program should populate the array by assigning the user-input integer...
Please Answer as soon as possible. Thank you so
much.
5. Below is an array with 15 positions, which is used as a hash table to keep some IDs. The key to each record is the 3-digit customer's ID. The hash function h gives the index of the slot in the array for the key k: h(k)=%15. The method of collision resolution is double hashing. Hence, if collision happens, we repeatedly compute (h(key) + iha(key)) mod 15, for i from...