Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a C++ program that stores information about a university roster in an array list and uses indexes to access records quickly. Each student record

Create a C++ program that stores information about a university roster in an array list and uses indexes to access records quickly.

Each student record will be stored in the array list in order of student ID. This means that, when we need to retrieve a student record based on student ID, we can use binary search. But what happens when we need to look up a student by last name, or date of birth? We would have to sequential search through the array until we find a match. Unless we have indexes!

An index contains two data: the searched value (or key), and its position in the array. This way we can keep the index sorted by key and retrieve the position of the record in the array, without having to create duplicates of the records.

Input and Output This program will need two input files to work: a file with the student records that will fill the array list, and a file with the key(s) that will need to be retrieved. Each student record will include (separated by comma): Student ID (string) First name (string) Last name (string) Date of birth (date) Major (string) GPA (float) Labels will be used in the key file to identify what field to search, followed by : ID FIRSTNAME LASTNAME DOB MAJOR GPA Example of input file for student records 03985, Carita, Palencia, 1988-06-14, CS, 3.24 11122, Nannie, Usrey, 1995-10-12, Math, 2.65 (more records) Example of input file for keywords LASTNAME: Palencia

The output file should include the full retrieved record (or records, in case of multiple matches/keys), followed by the number of accesses necessary to retrieve the record searching the array list and the one achieved using indexes. If no record is found, print No record found for

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions