Reference no: EM13161297
Some of the attributes of a state in the United States are its name, capital, area, year of admission to the union, and the order of admission to the union. Design the class stateData to keep track of the information for a state. Your class must include appropriate functions to manipulate the state's data, such as the functions setStateInfo, getStateInfo, and so on. Also, overload the relational operators to compare two states by their name. For easy input and output, overload the stream operators.
Use the class hashT, ''Hashing: Implementation Using Quadratic Probing,'' which uses quadratic probing to resolve collision, to create a hash table to keep track of each state's information. Use the state's name as the key to determine the hash address. You may assume that a state's name is a string of no more than 15 characters.
Test program by searching for and removing certain states from the hash table.
***************************************************************
You may use the following hash function to determine the hash address of an item:
int hashFunc(string name)
{
int i, sum;
int len;
i = 0;
sum = 0;
len = name.length();
for (int k = 0; k < 15 - len; k++)
name = name + ' '; //increase the length of the name
//to 15 characters
for (int k = 0; k < 5; k++)
{
sum = sum + static_cast<int>(name[i]) * 128 * 128
+ static_cast<int>(name[i + 1]) * 128
+ static_cast<int>(name[i + 2]);
i = i + 3;
}
return sum % HTSize;
}
Relative addressing mode is a special way
: Relative addressing mode is a special way to specify operands. Which instructions are associated with the relative addressing mode? Why do you think it was called "relative" addressing mode? Hint: Use a search engine to find out about "portable code"
|
Introduction to civilization
: During the Renaissance, European artists began to utilize which of the following in their paintings?
|
Two kinds of people sell eyeglasses in a state
: Two kinds of people sell eyeglasses in a state. Opticians have limited training but can competently prescribe and fit glasses. Optometrists are full-blown medical doctors who do all the same functions as optometrists but also can better spot eye dise..
|
Calculate the response to selection
: A population of sunflowers has an average time toflowering of 50 days.We select the sunflowers that floweredearliest; their average time to flowring is 35 days. We breed those5 early flowering plants with each other and plant the resultingseeds. w..
|
Searching f and removing certain states from the hash table
: use the class hashT, ''Hashing: Implementation Using Quadratic Probing,'' which uses quadratic probing to resolve collision, to create a hash table to keep track of each state's information. Use the state's name as the key to determine the hash addre..
|
Two gay men seek to get married
: Two gay men seek to get married in a state that does not allow gay marriage. State law requires that marriage be between an adult male and an adult female. Which constitutional theory might support an argument that the state is improperly infringing ..
|
Processor do when it receives an interrupt request
: What does the processor do when it receives an interrupt request from an external device? Describe the sequence of events and the signals activated.
|
What is the effective throughput of this lan?
: Consider a 20,000,000-character message to be transmitted between two stations that are 150 meters apart, using a 10BaseTX LAN with a transmission speed of 50 meters per microsecond
|
Calculate the allele frequencies of r and r
: The flower color of a certain species of snapdragon isdetermined by one gene with two alleles, R (red) and r (yellow). Ina population of 200 snapdragons, you see the followingphenotypes.
|