Question: Implement a HashTable for integers using open hashing to represent sets of integers. You must implement the hash table yourself and are not allowed to

 Implement a HashTable for integers using open hashing to represent setsof integers. You must implement the hash table yourself and are not

Implement a HashTable for integers using open hashing to represent sets of integers.

You must implement the hash table yourself and are not allowed to use the C++ standard

template library, i.e., you will need to implement a class for the set. Your set must provide

the basic set operations as discussed in class (add, delete, search, show, quit). Each

element of the set will be stored in a node object, i.e. you will need a separate class that

handles the nodes.

Upon starting your program, it will display the following prompt: set> (followed by a

space):

set>

The user can then add, delete, search, or show the set. If the element is already in the

set and you attempt to add that element to the set, then you need to display an

informational warning message. Similarly, if the element is not already in the set and you

attempt to delete that element from the set, then you need to display an informational

warning message.

Your hash table will have B=7 buckets and your hash function is h(x) = x^2 mod B.

FUNCTION DETAILS:

add will insert a number into the set and is followed by the prompt. If the element is

already in the set, provide an informational message WARNING: duplicate input: #

set> add 7

set> add 7

WARNING: duplicate input: 7

set> add 3

set>

delete will delete an element, if it is in the set. If the element does not exist, provide an

informational message WARNING: target value not found: #

set> delete 3

set> delete 8

WARNING: target value not found: 8

set>

search will return true or false to indicate if the element has been found

set> search 7

true

set> search 4

false

set>

show will list all the elements of the hash table in the following form:

set> show

()-()-()-()-()-()-()

set>

The parenthesis will contain the elements of the individual buckets, separated by

commas. The above example is the empty set

Assume the hash table contains the following elements (order of insertion matters, since

elements are appended at the end of a list for each bucket)

set> add 1

set> add 2

set> add 3

set> add 4

set> add 5

set> add 6

set> add 7

set> show

(7)-(1,6)-(3,4)-()-(2,5)-()-()

set>

quit will exit the program

set> quit

allowed to use the C++ standard template library, i.e., you will needto implement a class for the set. Your set must provide thebasic set operations as discussed in class (add, delete, search, show, quit).

1. Consider the Markov chain with the following transition matrix. 0 0.5 0.5 0.5 0 0.5 0.5 0.5 0 (a) Draw the transition diagram of the Markov chain. (b) Is the Markov chain ergodic? Give a reason for your answer. (c) Compute the two step transition matrix of the Markov chain. (d) What is the state distribution *, for t = 2 if the initial state distribution for t = 0 is no = (0.1, 0.5, 0.4) T?SOLVE ALL QUESTIONS CORRECT AND CLEAR I GONNA VOTE UP 1. Give and draw the pdf and cdf of a uniform random variable X. Find the mean and the variance of X. 2. Give the pdf and cdf of an exponential random variable X. 3. Give the pdf, cdf, and Q function of a standart Gaussian random variable X. (unit variance, mean zero) 4. Give the Markove and Chebyshev inequalities. 5. Give the moment generating function and characteristic function of a random variable X. How can the moments be found from the moment generating function and characteristic function?the patient is in the group treated with interferon alfa, and let B denote the event that the patient has a complete response. Determine the following probabilities. (a) P(A) (b) P(B) (c) P(AnB) (d) P(AUB) (e) P(A'UB) 2-81. A computer system uses passwords that contain exactly eight characters, and each character is one of 26 low- ercase letters (a-z) or 26 uppercase letters (A-Z) or 10 inte- gers (0-9). Let 2 denote the set of all possible passwords, and let A and B denote the events that consist of passwords with only letters or only integers, respectively. Suppose that all passwords in 2 are equally likely. Determine the probabil- ity of each of the following: (a) A (b) B (c) A password contains at least 1 integer. (d) A password contains exactly 2 integers. lying basic set operations to individual events. Unions of events, vents, such as AnB; and complements of events, such as A'-are bility of a joint event can often be determined from the probabili- it comprises. Basic set operations are also sometimes helpful in joint event. In this section, the focus is on unions of events. 2-1 lists the history of 940 wafers in a semiconductor manu- wafer is selected at random. Let / denote the event that the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!