Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1: Suppose you write a program that will store and manipulate many cust

ID: 3731695 • Letter: Q

Question

Question 1: Suppose you write a program that will store and manipulate many customer records, each comprising ID, name, address, etc. In each case below, explain which Abstract Data Type (studied in class) and which implementation (array or linked structure) you would use. Briefly justify your choices (a) A arge but unknown number of customer records wl 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) (b) One million customer records will be inserted by name, once each, in no particular order. They will be very frequently retrieved by name. (2 marks) (c) One million customer records will be inserted and stored in chronological order, then retrieved and processed likewise. (2 marks)

Explanation / Answer

A) Linked List will be used because the size of the arrays is fixed and inserting a new element in an array of elements is expensive, because room has to be created for the new element.Linked list uses dynmaic allocation concept and sequential searching which is good in this case.
b)we can use any data structue here linked list or array because we have fixed size i.e.one million and no order of storing . For retriving we need to search full till end.
But i recommend array because maintaining pointer in linked list is an overhead.

C)Array will be used because here we inserted record in one go so we dont need to modify array size and Random access is not allowed in linked list We have to access elements sequentially starting from the first node. So we cannot do binary search with linked lists.hence array is good in this case.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote