You will select an organization for which you will complete each of the assigned
ID: 3874632 • Letter: Y
Question
You will select an organization for which you will complete each of the assigned tasks. The organization can be real or fictitious, but the work that you complete needs to apply to the scenarios that are provided.
Your company is facing two new requirements for an existing application. The application manages customers and products, and it is been working fine for several years. Recently, the marketing department has requested the following improvements to the information technology (IT) department:
They want to be able to search for a specific product using the best search algorithm.
They want to be able to print a sorted list for all of the customers, using the last name as a key.
You have been assigned this project by your manager. Your company is not using databases to store the information for customer or products, so you will have to help it decide which algorithm to use when sorting a list of elements or searching for an element.
The existing information for customers is as follows:
- First name
- Last name
- Shipping address
- Billing address
- Phone number
- Customer ID
The information for the product is as follows:
- Product ID
- Name
- Description
- Wholesale price
- Sale price
- Inventory
In this week, you will create a Word document to do following tasks:
1. Describe your scenario company. **My scenario company is a fictional company that I will call ‘AirParts’. In this company they manage, store, inventory, sell and buy parts for different aircraft.**
2. Based on the product and customer data explained in this document, provide at least 2 different types of data structures for the customers and the products. Remember that the data structure selection can have an impact in the performance achieved by the algorithm.
3. Evaluate the benefits and disadvantages of each data structure.
4. Recommend 1 option, knowing that the operations that are going to be performed on the customers are sorting using different keys, and the operation that is going to be performed on the product data is mostly searching.
Explanation / Answer
2. Data Structures:
Products(search data structures): Hash Table or Heap
Customers(sorting data structures): Priority Queue or normal Array with quicksort algorithm
3. Hash Table:
Hash Tables are a powerful data structures. They store data as a key-value pair. the searching is very efficient as it takes O(1) time to search for a key and retrieve its data. Disadvantage being that we have to give special attention to minimize collisions among hash values else it will increase the time complexity of the search.
Heaps:
Heaps are a tree-based data structure. Every node satisfies a constraint, which is, the parent of every node is either greater than or equal to or less than or equal to its value. The constraint depends on whether we implement max heap or min heap. It searches in O(n) time. Disadvantage over hash tables is that its functions take more time to add( O(n) ) delete( O(n) ) or search( O(n) ) elements as compared to hash tables functions which have O(1) time for all its functions.
Priority Queue:
Priority Queue is widely used for sorting data. As the name indicates, all the elements in this are already sorted according to some parameter. Therefore, it is always sorted and does not require any algorithm to sort. The disadvantage is that inserting and deleting takes O( logn ) time complexity as compared to array which can give a time complexity of O(1). Getting values at index takes O(n) time and in array, it can be achieved in o(1) time.
Arrays:
Arrays are the simplest form of data structure but when used with quicksort algorithm, they can accomplish sorting in O(n2 ) time. The average running time is O(nlogn). Disadvantage is that, the space has to be declared before hand. Addition at some index, or deleting from some index can take O(n) time.
4.
For a searching algorithm, hash tables are the best as we want mostly searching capabilities.
Similarly, Priority Queue surpasses every other data structure in sorting capabilities.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.