Question: using linear search and binary search and please read the requirment carefully Assuming you have a struct Book Write a program that given an array

using linear search and binary search and please read the requirment carefully  using linear search and binary search and please read the requirment
carefully Assuming you have a struct Book Write a program that given

Assuming you have a struct Book Write a program that given an array of books (read from a file named "books.txt") of maximum size 100 , the program searches for a book by title or by author (give the books.txt user the choice) and then when found, the book full info is displayed. You should have 2 implementations for the search function: The first method to search within an array sequentially (linear search). But, linear search has O(n) complexity, so for the second methos, search online for a better option and implement it. Now your program should have 2 functions for searching books. When running your program, call both search functions and print the number of comparisons each took to find the book, then print the book info. Your program should keep running and take another title/author to find, until the user chooses to exit. Sample Run: Note: You may not use the built-in STL search functions, but you're allowed to use STL sort if you need to

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!