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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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