In C++, create a hash table for names (first name and last name only, no telephone numbers), and use the following to generate the keys:
unsigned char key = 0;
for (int i = 0; i < fullName.length(); i++)
key ^= fullName[i];
Use the following names to test your program:
Uzoma Acholonu
Giuliana Asmad
Michael Atkins-Combs
Vishnu Bakthisaran
Christopher Blowars
William Bronson
Trevor Butcher
Tiffany Caceres-Bonilla
Dulce Castro
David Cifuentes
Daniel Coursen
Alexandra Davilla
Amanda Dewitt
Alfredo Diaz
Jan Espinosa
Anthony Farrisi
Seth Fenstermaker
Daniella Gabout
Regina Green
Kelly Gregory
Bryan Houser
Michael Jackamorris
Kevin Kim
Benjamin Lee
Kyle Lighting
Perlamassiel Lopez
Omran Losinno
Lisa Maine
Derrike Mason
Andrew McCalla
Alexander McConnell
Niral Modi
Aida Montanez
Christopher Price
Daniyal Raza
Morgan Rex
Andres Rivero
Thomas Rudnicki
Kyle Russell
Samantha Rutkowski
Jaskamal Saini
Kyle Schmidt
Taylor Schnappauf
Ryan Snyder
Heazel Souid
Jason Spiegel
Minh Tang
Tehillah Trauger
Alexis Tocci
Luis Virola
Dale Wenger
Malik White
Jaimie Williams
When done loading the hash table print out the contents of each occupied entry, and any other entries pointed to by an occupied entry in the following format (use tabs, the columns do not have to line up):
Slot 51 is occupied with
Alexandra Davilla Ryan Snyder
Slot 56 is occupied with
William Bronson Derrike Mason Taylor Schnappauf Jason Spiegel
You do NOT have to print out the statistics. Please add comments.
SourceCode:
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#define size 30
using namespace std;
typedef struct
{
string fulname; // for the filename ... change this to your specification//
}hashd;
hashd hashArray[size]; // tentative
int returnHash(string s)
{
// A simple hashing, no collision handled
int sum=0,ind=0;
for(string::size_type i=0; i < s.length(); i++)
{
sum += s[i];
}
ind = sum % size;
return ind;
}
int main()
{
string Name;
int ind;
cout << "Enter name is -\t" ;
cin >> Name;
cout << "Enter name is -\t" + Name << "\n";
ind = returnHash(Name);
cout << " Index is -\t" << ind << "\n";
hashArray[ind].fulname = Name;
return 0;
}
Output:
In C++, create a hash table for names (first name and last name only, no telephone...
C++ Create an application that searches a file of male and female first names. A link to the file is provided on the class webpage. "FirstNames2015.txt" is a list of the most popular baby names in the United States and was provided by the Social Security Administration. Each line in the file contains a boy's name and a girl's name. The file is space-delimited, meaning that the space character is used to separate the boy name from the girl name....
Write a program that reads in BabyNames.txt and produces two files, boynames.txt and girlnames.txt, separating the data for the boys and the girls, and listing them in alphabetical order. This is the code I have, Its not sorting the boys/girls names in seperate files. It is creatinf two files, but has all the names. I also need to alphabetize the names. with an Array. sort import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class BabyNames{ public static void main(String[]...
CREATE TWO C++ PROGRAMS : Program 1 Write a program that reads in babynames.txt (provided) and outputs the top 20 names, regardless of gender. The file has the following syntax: RANK# BoyName Boy#OfBirths Boy% GirlName Girl#OfBirths Girl% You should ignore the rank and percentages. Compare the number of births to rerank. Output should go to standard out. Program 2 Write a program that reads a text file containing floating-point numbers. Allow the user to specify the source file name on...