Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c + + language and please WITHOUT CHATGPT : You are tasked with implementing a simple book search system for a library. The library

using c
+
+
language and please WITHOUT CHATGPT :
You are tasked with implementing a simple book search system for a library. The library
contains a collection of books, and users should be able to search for a book by its title.
Implement two search algorithms: linear search and binary search.
Task
1
: Data Structure
Define a structure or class called Book to represent a book. Each book should have at
least the following attributes:
Title
(
string
)
Author
(
string
)
ISBN
(
string or int
)
Task
2
: Linear Search
Implement a linear search function that takes an array of Book objects and the title of
the book to search for. The function should return the index of the book in the array if
found, or
-
1
if not found.
Task
3
: Binary Search
Assume that the array of Book objects is sorted alphabetically by title. Implement a
binary search function that takes the sorted array and the title of the book to search for.
The function should return the index of the book in the array if found, or
-
1
if not found.
Task
4
: User Interaction
In the main function, create an array of Book objects. Allow the user to input the title of
a book they want to search for. Use both the linear search and binary search functions
to find the book and display the results.
Task
5
:
Implement a more sophisticated search system that allows users to search by author or
ISBN as well.
Note:
Ensure that the user can input the title of the book.
The binary search assumes that the library is sorted alphabetically by title. Sorting is
done before binary search in this example.

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_2

Step: 3

blur-text-image_3

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

5w 3 > 3w 9

Answered: 1 week ago