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 a program to find that number for nguyen.

In some Asian countries, 8 and 6 are considered lucky digits. Any number containing only 8s and 6s is considered lucky number, e.g. 6, 8, 66, 668, 88, 886 .... Nguyen is a student who likes mathematics very much. Nguyen likes lucky numbers but only o..

  Design class for textbook-data field for grade level of book

Design a class named TextBook that is child class of Book. Include new data field for grade level of book. Create a displayTextBookInfo () method so that you can accommodate new grade-level field.

  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)

  Include the iostream, fstream, string, and cctype libraries

1. Include the iostream, fstream, string, and cctype libraries in your program.

  Write a program in c that will find smallest value

Write a programe c that will find the smallest, largest and average values in a collection of N numbers.Get the value of N before scanning each value in the collection of N numbers.

  Program to compute and show miles per gallon

Create the program in C++ which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and show miles per gallon.

  Create a program that maintains the required book catalog

Create a program that maintains the required book catalog for the circulation desk of a library.

  Implement circular linked list in c program

implement circular linked list in c program in the best possible easiest way.

  Design for storing the maze layout

Design and implement a C++ program for maze layout

  Write short c program to develops two processes

Write down a short C program which develops two processes. Each process must repeatedly write its own unique message to test file, one character at time. Do you see garbled messages in the file? Explain why or why not?

  Implement a simplified version of the set class

You will implement a simplified version of the set class. You must implement all functions defined in the provided file set.h. You may add other member functions and variables as necessary.

  Write a program the contains an array of 1000 elements name

Write a function named equals() that accepts two char arrays and return true if both arrays have the same characters in the same order. The function should return false otherwise. Write a simple main() function to test your function.

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