Searching f and removing certain states from the hash table

Assignment Help C/C++ Programming
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;
}

 

 

Reference no: EM13161297

Questions Cloud

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.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write program to input series of hourly temperatures

Create and write a c++ program which inputs series of 24 hourly temperatures from file, and outputs bar chart (using stars) of temperatures for the day.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Assign passed value to function to return value

Assign passed value to this member and another function to return value. Your main should read the integer from an input data file, and write the output to the output data file.

  Write c program to read one ip address

Write a C or C++ program which Read one IP address at a time from Dec_IPAddresses.txt and convert it into Hex. Store converted values stored in another file (e.g. HEX_IPAddresses.txt).

  Function declare that it can throw an ioexception

Every C++ function that performs file I/O will thus need to either declare that it can throw an IOException, or contain a try-catch-finally block to deal with it. Response?

  Write program using c language to find page fault

Write program using c language to find page fault for individual processes, group of processes and system as whole using following system call int sys_pgfltstats(pid_t pid,int flag,pf_info_struct *info).

  Principle ofsuperposition to determine that system is linear

Apply the principle of superposition to determine whether the following systems are linear. Sketch what the plot of the function looks like.

  Develop a simple poker game

Develop a simple poker game

  Object oriented programming paradigm is better choice

Explain why object oriented programming paradigm is considered better choice than structured programming paradigm. Does it reflect our "natural" way of thinking or do you find it artificial?

  Object-oriented systems is the concept of object

At the heart of all object-oriented systems is the concept of an object. Simply stated, an object is a set of related characteristics and their associated actions.

  Program to produce ten random permutations of numbers

In C++(must be able to compile in Visual Studio ): Write a program to produce ten random permutations of numbers 1 to 10.

  C program to randomly generate more than ten ip address

Write C or C++ program which Randomly generates more than 10 IP addresses written in decimal format and write results in text file (e.g. Dec_IPAddresses.txt)

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd