There are n books in a library (assuming that you do not know n). Each book has Book Id Number, Book Title, One main author (A book can be written by many author but only one author will be main author), and Name of Publisher. There can be multiple copies of single title book. Books are identified by Book Id Number (there will be unique book id even if there are multiple copies of single titled book). These Book Id’s are 6 digit numbers starting from 100001 onwards. Each book has issue slip of m fixed records. These records have following fields: Issue Date, Return Date, and Enrolment number of student to whom the book is currently issued. If one issue slip is completely filled then another issue slip of m records is attached with that book along with previous one.
Propose an efficient data structure if (a) n is known (b) if n is unknown, such that following queries can be answered efficiently.
(i) Display the list of books which are currently issued.
(ii) If one requires a book then he/she is supposed to enter book title. Display that the entered book is available in the library or not (remember that a single titled book can have multiple copies but different book id number).
(iii) Assuming that a book will not be issued to a student if there are 6 books already issued to him/ her. Now if there is a request from a student to get a book issued, then display the message whether he/she is entitled for that or not.
(iv) Assuming that if book is not returned by a student by its due date there will be late fine of Rs. 5 per day. Display the name of student who is supposed to pay maximum late fine.
(v) Due to rough handling of books, it is required to remove the book from Library. Therefore delete the records of that book from the list of books.
(vi) Library authorities keep on purchasing books at regular intervals and assign Book Id to each newly purchased book. Allotment of Book Id’s are based upon the fact that starting from Book Id number 100001 upto last book id no number is missing. Say due to rough handling Book Id number 100025 records were deleted from the list of books. Then one of the arrived books will have Book Id as 100025.