Question: A librarian assigns a numeric code to all the books She maintains a key value pair to map the book name to the numeric code
A librarian assigns a numeric code to all the books
She maintains a key value pair to map the book name to the numeric code
Book shelves are marked with the numeric code
She follows a certain arrangement logic for storing her books
It is just that it is a digital library and the books are in the kindle format and the shelves are nothing but a certain space in her computer memory disk
When a customer requests a book, she searches for the book, retrieves the book from the digital shelf and issues the book to the customer
When a customer returns a book, she stores the book in the digital shelf
Design a data structure to search, store, retrieve books and use divide and conquer algorithm to implement that data structure.
Start the library with a fixed set of books. Get the book names from the input file and assign a code. Store the books in the digital library.
Simulate the issuance and return of books through another input file, where the input contains the time, book name, transaction code as I for Issuance and R for return of books.
Output file should contain
The representation of books along with their numeric codes at the start.
After every transaction, output the representation of books along with their numeric codes.
For the purpose of this assignment, assume that the book names are represented only by alphabets. Hint: Use ASCII code of alphabets
Read the input from a file input and inputstxt
inputtxt has the fixed format as mentioned below with each book names separated by a comma AFBLCGKM
inputstxt
:: I, C
:: R H
:: I, L
:: R C
Display the output in output.txt
You can write the output as comma separated values. for the above input the ouput is:
Shelf:
Book: ABCFGKLM
Shelf:
Book: ABFGKLM
Shelf:
Book: ABFGHKLM
Shelf:
Book: ABCFGKM
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
