Question

In: Computer Science

Safaricom service provider has assigned you a task in their software section to design an application...

Safaricom service provider has assigned you a task in their software section to design an application that can be used by wholesalers to buy their products. Your duty is to implement the data structure which can be used to store the inventory of the warehouse containing the products. The data structure should be able to add a product with an associated code indicating its likelihood to spoil, remove a product that is most likely to spoil, and return the overall number of products in the inventory.

i.          Describe the data structure you would use and give reasons.

ii.         With reference to algorithms, explain the terms time efficiency and space efficiency.

iii.        Describe a non-linear data structure. Give examples and operations in which you might perform on such a structure.         

Solutions

Expert Solution

i.

The data structure that will ber good for this purpose would be linked list.

linked list is dynamic in nature and it does not wastes memory (unlike an array where size has to be fixed beforehand) and also does not overflows (provided RAM is large enough). it takes O(n) space where n is the number of items.

For the purpose of the question , we will store the inventory in linked list form with the elements sorted in increasing order of their likeliness of getting spoiled.

to remove the item that is most likely to spoil we just remove the first element of the linked list. It takes O(1) time.

to add an item we iterate over the linked list from start to end and put the item in correct place.the correct place is defined its likelihood of getting spoiled. It takes O(n) time

to return number of elements in inventory we maintain a count variable. it is incremented by 1 everytime an inventory is added and decreased by 1 everytime an item is removed. it takes O(1) time

iii.

A non linear datastructure for this problem would be max-heap (assuming higher code value= higher likelihood of gettinng spoiled). it also takes O(n) space

to remove the item that is most likely to spoil we just remove the root of the heap. but removing the root would break the heap and in order to restore the heap we call HEAPIFY() which take O(log(n))

Insertion in a Heap takes log(n) time.

to return number of elements in inventory we maintain a count variable. it is incremented by 1 everytime an inventory is added and decreased by 1 everytime an item is removed. it takes O(1) time


Related Solutions

You are asked to design a relational database for a simple course registration software application for...
You are asked to design a relational database for a simple course registration software application for your school. The relational database must have the following information about the student, the course, and the registration, respectively StudentID, FirstName, LastName, DataOfJoining, and Major CourseNumber, CourseName,InstructorName, StartDate, EndDate, NumberOfCredits ReferenceID, StudentID,CourseID, DateOfRegistration Apply the following constrains while designing the database Each student in the database must be uniquely identifiable Each course listed in the database must be have unique CourseNumber Each course registration...
HPP Software House has been assigned as Lead developer for CIMM Bank Mobile Application. a) Prepare...
HPP Software House has been assigned as Lead developer for CIMM Bank Mobile Application. a) Prepare project scheduling (Gantt Chart) by implementing Agile development methodology phases. Your Gantt chart should consist of the following requirements. i. SIX (6) phases that consist of 2 sprints. ii. TWO (2) Task for every phases identified in the above question. iii. FIVE (5) deliverable or milestone b) Elaborate FOUR (4) software projects management spectrum based on the project perspective. c) Describe THREE (3) categories...
wirte a program in java Part I     Internet Service Provider An Internet service provider has three...
wirte a program in java Part I     Internet Service Provider An Internet service provider has three different subscription packages for its customers: Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour. Package B: For $13.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour. Package C: For $19.95 per month unlimited access is provided. Write a program that calculates a customer’s monthly bill. It should ask...
The Board of Directors of ABC Co Ltd has assigned you the task of analysing the...
The Board of Directors of ABC Co Ltd has assigned you the task of analysing the Discounted Cash Flow (DCF) technique for appraising large investment decisions. Write a report to them giving your observations.
Adobe Consulting Services (ACS), a provider of HR software application systems, prides itself on the variety...
Adobe Consulting Services (ACS), a provider of HR software application systems, prides itself on the variety of benefits it offers employees. In addition to health care, pension, and vacation benefits, the company also offers an attractive family-friendly benefits package including flexible schedules, child and elder care assistance, counseling services, adoption assistance, and extended parental leave. Unfortunately, sometimes the company’s progressive work-life policy experiences a backlash from several employees, as the following case illustrates. In March 2011, Teresa Wheatly was hired...
OA company recently hired a payroll service provider to process its payroll-that service provider has essentially...
OA company recently hired a payroll service provider to process its payroll-that service provider has essentially taken over the payroll function, and payroll represents OA's largest expense. Comment on the following statement: OA's auditors should make certain that the payroll service provider's most recent financial statements are audited, and that the related audit report includes no indication of a weakness in internal control related to processing its own payroll.
Imagine you are consulting for an Internet service provider (ISP) that has hired you to research...
Imagine you are consulting for an Internet service provider (ISP) that has hired you to research the impact of customer retention on their bottom line. Assume that their current monthly turnover is 3%, they have 1000 subscribers, they have set monthly subscriber fees at $25, and they estimate that their cost to serve customers is $10. Further, while they report that they do not have an estimate for customer acquisition cost, you do a little number crunching and find that...
The task: You are working in a partnership position in a company and An existing Provider...
The task: You are working in a partnership position in a company and An existing Provider is looking for 10X growth with your company in 2020. you have scheduled a call with the provider's manager. Your CEO is also invited to this call. 1- Please write down a structure for the call and draft 3-5 potential solutions that you supposed to discuss with the partner. 2- prefer/prioritize these solutions in a way you expect to achieve the best result from...
The task: You are working in a partnership position in a company and An existing Provider...
The task: You are working in a partnership position in a company and An existing Provider is looking for 10X growth with your company in 2020. you have scheduled a call with the provider's manager. Your CEO is also invited to this call. 1- Please write down a structure for the call and draft 3-5 potential solutions that you supposed to discuss with the partner. 2- prefer/prioritize these solutions in a way you expect to achieve the best result from...
Internet Service provider Part 1 (Java Program) An Internet service provider has three different subscription packages...
Internet Service provider Part 1 (Java Program) An Internet service provider has three different subscription packages for its customers: Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour. Package B: For $13.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour. Package C: For $19.95 per month unlimited access is provided. Write a program that calculates a customer’s monthly bill. It should ask the user to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT