Can anyone help me with this? It\'s a C++ Data structures and algoirthms course.
ID: 3850513 • Letter: C
Question
Can anyone help me with this? It's a C++ Data structures and algoirthms course.
Question 1: Suppose you 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 (studied in class - we have covered STACKS, QUEUES, LISTS, UNSORTED LISTS, SORTED LISTS) you would use, and which implementation (array or linked structure). Briefly justify your choices.
(a) 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. (2 marks)
(b) All records will be inserted at the beginning, once and in no particular order. They will be retrieved very frequently, based on serial number. (2 marks)
(c) 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. (2 marks)
Explanation / Answer
A) Queue with link list is used to store the data because in link list we have records as per our requirment and queue are used for first in first out.
B) Sorted list is used to store data and retrieved very frequently, based on serial number because data is accessed using a key or an index.
C) Unstored list used to store the data are placed in no particular order and inserted and reterived whenever they required.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.