There is a question that I have been trying to solve for a while but I'm having difficulty to grasp the correct implementation for it. If we write a program that will manipulate thousands of records, each comprising product name, type, serial number, retail price, etc. In each case below, explain which Abstract Data Type (Queue, Stack, Unsorted and Sorted List) you would use, and which implementation (array or linked structure). Briefly justify your choices.
1) Records will be retrieved in the same order they were stored. There is no telling in advance how many records will be processed and how.
I prefer Unsorted list for this purpose which used linked list implementation because we don't know the number of records at beginning,and data will be retrieved as they are stored hence they must be linked which can also be possible by ADT like Queue or Stack but they use array implementation hence memory allocation problem arises.
2) All records will be inserted at the beginning, once and in no particular order. They will be retrieved very frequently, based on serial number.
Even in the case of printing all the data of records at one time it will be possible with the Unsorted list.
3) A large but unknown number of product records will be inserted, as and when needed. They will seldom be retrieved individually. Most operations will consist of processing all records at one go e.g., printing all.
However here sorted and Unsorted list had more efficiency to use but I prefer Unsorted list because it takes time for sorting which decreases its efficiency.
What do you guys think?
What I have tried:
I have tried answering the problem as given above in the question.