Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++. Fill out main parts of code/functions and it'll still be helpful! Arrays and vectors can be used to hold lists. For this homework assignment,

C++. Fill out main parts of code/functions and it'll still be helpful!

image text in transcribed

image text in transcribed

image text in transcribed

Arrays and vectors can be used to hold lists. For this homework assignment, you will be making a book list program. Write a program to support the following functions on a book list. You can assume that you will not be buying more than 20 books Insert new element at the end of the list Insert new element at a certain position Find an element (with its ISBN number and list its position) using linear search Find an element (with its ISBN number and list its position) of a sorted list using binary search Delete an element that is at a certain position Delete an element by using its ISBN number Sort the list by the ISBN numbers (using selection sort) - Use pointers for accessing array elements Sort the list by the ISBN numbers (using bubble sort) - Use pointers for accessing array elements Print out the list For the sorting functions, do not use the array indices to access the array elements. For example, do not use arravl5]. Instead, use pointers to access the array elements (example: *(array + 5)) Your program should begin with a loop asking the user what they want to do. Clearly, at the beginning since there is no list, they have to begin by inserting a new element at position 1 (note, when calling the function to insert an element at a certain position, you have to check that the position is within bounds of the current book list) For your implementation, you can assume that the user will enter the ISBN number of the book (so you can use integers for your list). Use arrays or vectors. (If you use vectors; however, you must implement all of the functionality below and not use the built-in functions on vectors for this assignment.) You only need to use either arravs or vectors The function headers should look something like the following (variables names and parameters don't need to exactly match) void insert(int mylistl ], int oum in list, int new element) int find linear(int mylist [ ], int uum in list, int element); int ind binary(int mvlist [ ], int uum in list, int element, bool sorted); (int mylist [ ], int oumin list int position) (int mylist [ 1, int oum in list, int element); int mylist [ ], int oum in list) (int mylist [ ], int oum in list); void.print (int mylistl I, int oum.in list)

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions