Question: Complete the required missing codes for the program to run correctly. #include #include #include person.h #include list.h using namespace std; List::List ( )
Complete the required missing codes for the program to run correctly.
#include
#include
#include "person.h
#include "list.h
using namespace std;
List::List
start index when list is empty
lepos ;
initialize the list
for int i ; i MAXLIST; i
plisti Person;
add person to system list
void List::addint id string name, double salary
Person p Personid name, salary; creates person
plistlepos p; adds person
lepos; increment lepos
add person to system list at index
void List::addAtint index, int id string name, double salary
"REMEMBER"
You are adding a person to the list at index passed
remove all the comments abovebelow in this block when you
write codes
Write your codes here
removes a person from list by id
void List::removeint id
locate the person
for int i ; i lepos; i
if a match is located
if plistigetId id
once located, shift elements leftward to replace
the person to be deleted
for int j i; j lepos; j
plistj plistj ;
cout person removed successfully. endl;
lepos; decrements list
i lepos; set to exit loop
selection sort
void List::selectionSort
"REMEMBER"
You are sorting people in the list
remove all the comments abovebelow in this block when you
write codes
Write your codes here
quick sort helper function
void quickSortingPerson person int left, int right
"REMEMBER"
You are sorting people in the list
remove all the comments abovebelow in this block when you
write codes
Write your codes here
quick sort root function
void List::quickSort quick sort algorithm
quickSortingplist lepos ; call helper function
searching for the person with largest salary
using linear search algorithm
Person List::personLargestSalary
initial maximum salary
int maxindx ;
search the next
for int i ; i lepos; i
if plistigetSalary plistmaxindxgetSalary
maxindx i;
return &plistmaxindx;
return the people list of the system
Person List::getList
return plist;
returns the size of list showing number of people in list
int List::getLength const
return lepos;
searches for a person by id using binary search and returns its
reference if found, otherwise, returns a NULL
Person List::searchPersonint id binary search
"REMEMBER"
You are searching for a person
remove all the comments abovebelow in this block when you
write codes
Write your codes here
prints the list of people
void List::printList
Person ps plist;
for int i ; i lepos; i
cout pspersonRecord endl;
ps;
Use of array directly
for int i ; i lepos; i
cout plistipersonRecord endl;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
