Question: Implement two functions specified in list.h. You need to fill in the implementation in list.cpp: bool insert(int val, int intList[], int& size) the above function

Implement two functions specified in list.h. You need to fill in the implementation in list.cpp: bool insert(int val, int intList[], int& size) the above function will insert val into the correct position of a sortedintList and increment size. When doing the insertion, the list should maintain sorted. For example, when the list is [3], after inserting 1, it should become [1, 3]. It returns false if intList has val already and it wont insert the duplicate. You should not use a sorting algorithm for this. bool remove(int val, int intList[], int& size) the above function will remove val from intList and decrement size. For example, when the list is [1, 3, 5], after removing 3, the list should be [1, 5]. It returns false if intList doesnt have val

This is the main.cpp

const int ARRAY_CAP = 100; int main() { int aList[ARRAY_CAP]; int size = 0; print(aList, size); insert(10, aList, size); insert(10, aList, size); insert(4, aList, size); insert(40, aList, size); insert(25, aList, size); print(aList, size); if(!remove(5, aList, size)) { cout << "the list doesn't have 5" << endl; } if(!remove(10, aList, size)) { cout << "the list doesn't have 10" << endl; } if(!remove(40, aList, size)) { cout << "the list doesn't have 40" << endl; } if(!remove(4, aList, size)) { cout << "the list doesn't have 4" << endl; } print(aList, size); return 0; } 

I need this

list.h

#ifndef LIST_H #define LIST_H

bool insert(int val, int intList[], int& size) { if(int } bool remove(int val, int intList[], int& size) {

} void print(const int intList[], int size) { for(int i = 0; i < size; i++) { cout << intList[i]; }

}

#endif

I also need:

bool insert(int val, int intList[], int& size) { //insert your code here and modify the following line return true; } bool remove(int val, int intList[], int& size) { //insert your code here and modify the following line return true; } void print(const int intList[], int size) { cout << endl << "[ "; for(int i=0; i 

Thanks for the help!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!