Fill in Order Details

  • Submit paper details for free using our simple order form

Make Payment Securely

  • Add funds to your account. There are no upfront payments. The writer will only be paid once you have approved your paper

Writing Process

  • The best qualified expert writer is assigned to work on your order
  • Your paper is written to standard and delivered as per your instructions

Download your paper

  • Download the completed paper from your online account or your email
  • You can request a plagiarism and quality report along with your paper

please help me with c the part of the code and file are given below

If you’ve used an Android phone, you know that the Google Play Store is the central location for locating applications (Apple fans will recognize this as the App Store). For each “app” in the store there is a record that contains information such as the name, category, rating, etc. — allowing you to view an information page and decide if you want to install that app on your device.

In this assignment you you will experiment with hash functions (or invent your own!) to implement a directory of information about mobile apps.

Input

The supplied input file in this module — googleplay.csv — contains entries for approximately 6000 applications. This is another CSV file similar to what we used in Lab #7. Each line contains information about a single app. There are 4 comma-separated fields, in this order: name, category, rating and reviews. You can assume the name field of each entry is unique to the file (this will be important for your hash function), but this is not true of any of the other three fields. The name field is a string of readable characters that can include spaces and punctuation.

Assignment

Write a program that implements a hash table using any of the methods described in Chapter 18 or in class. You are free to use any hash function of your creation and any method you choose to handle hash collisions. A good place to start for a hash key is to use something about the name — the first letter? the last letter? the first three letters? (these will all work, but none are a very good choice). To handle collisions, you could chain them with a linked list on each “bucket”, or use open addressing with linear probing, for example.

A starter file — main_googleplay_starter.cpp — is provided. This file implements the framework for the hash table and reading of the file. Some functions are marked for your implementation (i.e. appFind() and appInsert()).

Requirements

  • The program should ask for input of an app name (which may include spaces and punctuation) and output the details of the app, if it is found in the hash. Loop until an exit is requested (blank name, -1, etc.).
  • Your program only needs to implement the “add” and “lookup” functions, not deletes or rehashing/resizing of the table.
  • If the app is not found, output “Not found in the table” or similar.
  • This time, do not use any STL or any third-party libraries (for example, a Map) to implement the hash — it must be a hash of your own creation.
  • Do not use any hard-coded values, i.e. fixed strings that return responses to fixed questions. The program must be able to retrieve any of the keys available in the file.
  • Each entry should be hashed (some key generated, based in something about the record) i.e. do not just read the data into an array or some other fixed structure.
  • Output the average number of comparisons required to add all the entries from the file, and the number of comparisons for each successful or failed lookup.

See if you can bring down the number of comparisons from your first attempt. A little Google searching will yield some string-optimized hash functions. There is no “right” answer, but hash functions that perform very poorly (close to a linear search) will lose points.

Example Output

Read 6239 apps.
Average comparisons required: 1.78
Enter an app name (<return> to quit): Mandala Coloring Book

Found, comparisons required: 8
Name: Mandala Coloring Book
Category: ART_AND_DESIGN
Rating: 4.6
Number of reviews: 4326

Enter an app name (<return> to quit): Monster Ride Pro

Found, comparisons required: 2
Name: Monster Ride Pro
Category: GAME
Rating: 5.0
Number of reviews: 1

Enter an app name (<return> to quit): SuperVPN Free VPN Client

Found, comparisons required: 1
Name: SuperVPN Free VPN Client
Category: TOOLS
Rating: 4.3
Number of reviews: 576454

Enter an app name (<return> to quit): Calculus with Bobby Flay

Not found in the table.
Comparisons required: 6

Enter an app name (<return> to quit): _x000D_ _x000D_

main_googleplay_starter.cpp:

_x000D_ #include <iostream>

#include <sstream>

#include <fstream>

#include <cstdlib>

using namespace std;

#define FILENAME “googleplay.csv”

// A single app in the Google Play Store. If you are using

// chaining, you may need to add an additional structure here (or a

// ‘next’ pointer within this structure) to maintain the chains in

// each bucket.

typedef struct {

string name;

string category;

double rating;

int reviews;

} googlePlayApp;

// Starting size. Don’t adjust this unless absolutely necessary.

const int HASH_SIZE = 10007;

// Hash table for all of the apps — static so it’s zeroed. This

// is an array of pointers (change as needed).

static googlePlayApp *appHash[HASH_SIZE];

// Reads a single app, filling in the

// fields (name, etc.) passed by the caller. The caller

// is expected to pass a single line (row) from the csv file.

void readSingleApp(const string &str,

googlePlayApp &newApp) {

istringstream istr(str);

string fields[5];

string tmp;

int i = 0;

// Read in each csv column

while (getline(istr, tmp, ‘,’)) {

fields[i++] = tmp;

}

// Populate the new item with the column info

newApp.name = fields[0];

newApp.category = fields[1];

newApp.rating = atof(fields[2].c_str());

newApp.reviews = atoi(fields[3].c_str());

}

// Insert a new app into the hash table. You may want to add a

// reference variable here to track number of comparisons.

void appInsert(googlePlayApp &newApp) {

// Implement this function

}

// Find an app in the hash table

// Returns ‘true’ if the app was found, filling in the

// fields of ‘foundApp’, else false. You may want to add a reference

// variable here to track number of comparisons.

bool appFind(const string &name, googlePlayApp &foundApp) {

// Implement this function

}

int main() {

ifstream inFile(FILENAME);

string inputLine, inputStr;

int linesRead = 0;

// Read in each app entry

while (getline(inFile, inputLine)) {

googlePlayApp newApp;

readSingleApp(inputLine, newApp);

appInsert(newApp);

linesRead++;

// For extra debugging output

//if (linesRead % 1000 == 0)

// cout << “Inserted ” << linesRead << ” entries”

// << endl;

}

if (linesRead == 0) {

cerr << “Reading failed.” << endl;

return (-1);

} else {

cout << “Read ” << linesRead << ” apps.” << endl;

}

for (;;) {

string tmp;

googlePlayApp foundApp;

cout << “Enter an app name (<return> to quit): “;

getline(cin, tmp);

if (tmp == “”) {

break;

}

if (appFind(tmp, foundApp) == false) {

cout << “Not found in the database.” << endl;

continue;

}

// Output the app info here

cout << “Name: ” << foundApp.name << endl;

// …

}

return (0);

}

WHAT OUR CURRENT CUSTOMERS SAY

  • Google
  • Sitejabber
  • Trustpilot
Zahraa S
Zahraa S
Absolutely spot on. I have had the best experience with Elite Academic Research and all my work have scored highly. Thank you for your professionalism and using expert writers with vast and outstanding knowledge in their fields. I highly recommend any day and time.
Stuart L
Stuart L
Thanks for keeping me sane for getting everything out of the way, I’ve been stuck working more than full time and balancing the rest but I’m glad you’ve been ensuring my school work is taken care of. I'll recommend Elite Academic Research to anyone who seeks quality academic help, thank you so much!
Mindi D
Mindi D
Brilliant writers and awesome support team. You can tell by the depth of research and the quality of work delivered that the writers care deeply about delivering that perfect grade.
Samuel Y
Samuel Y
I really appreciate the work all your amazing writers do to ensure that my papers are always delivered on time and always of the highest quality. I was at a crossroads last semester and I almost dropped out of school because of the many issues that were bombarding but I am glad a friend referred me to you guys. You came up big for me and continue to do so. I just wish I knew about your services earlier.
Cindy L
Cindy L
You can't fault the paper quality and speed of delivery. I have been using these guys for the past 3 years and I not even once have they ever failed me. They deliver properly researched papers way ahead of time. Each time I think I have had the best their professional writers surprise me with even better quality work. Elite Academic Research is a true Gem among essay writing companies.
Got an A and plagiarism percent was less than 10%! Thanks!

ORDER NOW


Consider Your Assignments Done

“All my friends and I are getting help from eliteacademicresearch. It’s every college student’s best kept secret!”

Jermaine Byrant
BSN

“I was apprehensive at first. But I must say it was a great experience and well worth the price. I got an A!”

Nicole Johnson
Finance & Economics

Our Top Experts

See Why Our Clients Hire Us Again And Again!


OVER

10.3k
Reviews

RATING
4.89/5
Average

YEARS
13
Mastery

Success Guarantee

When you order form the best, some of your greatest problems as a student are solved!

Reliable

Professional

Affordable

Quick

Using this writing service is legal and is not prohibited by any law, university or college policies. Services of Elite Academic Research are provided for research and study purposes only with the intent to help students improve their writing and academic experience. We do not condone or encourage cheating, academic dishonesty, or any form of plagiarism. Our original, plagiarism-free, zero-AI expert samples should only be used as references. It is your responsibility to cite any outside sources appropriately. This service will be useful for students looking for quick, reliable, and efficient online class-help on a variety of topics.