Comprehensive Inventory System Design: Algorithms, Variables, and Keys

Verified

Added on  2022/10/10

|11
|2409
|92
Report
AI Summary
This report details the design and implementation of an inventory system for a company managing household and food items. It covers the use of variables (static and instance), keys (super key, unique key, primary key), and ranges for efficient data management. The report specifies operations like sorting product type, searching by product name, manufacturer, and expiry date. It then explores appropriate algorithms for each operation, including sorting and binary search, with justifications for their selection based on dataset size and complexity. The report analyzes two scenarios: the initial system and a system after a merger, discussing necessary changes in algorithms and data structures to accommodate increased product volume. The report concludes with a discussion on the impact of the changes on the algorithm selection. The report also includes references to relevant academic sources.
Document Page
Inventory System
Name of the Student:
Name of the Lecturer:
Date of Submission:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Introduction
This paper discusses a system designed for a company to help them keep a record of two
inventory items of two types including the household items and food items. To that end, this
system will be designed in such a way that the products’ description or information is stored with
the product itself. The operations for each inventory system have been specified. Also, in each of
the operations performed in the system, the sorting and searching algorithms will also be
provided. The paper also provides a recommendation to the company after the merger with
another company on the changes which they are supposed to undertake to the system to ensure
continuous operations.
Appropriate Variables, Keys and to be used.
Variables Used:
The variable used in the systems will be of type static simply because they need to be accessed in
every instance. The reason why they were not declared as local variables is because the
information will be shared by all product types. However, since the expiry date of the food item
will be used only on the food item it will be declared as an instance variable since it will only be
used on the method expiry date method (McKinney, 2010). The variables include:
String productName;
int productPrice;
String productManufacturer;
Date expiryDate:
Key
To identify and establish a relationship between the different record it will be important to use
the appropriate key. For this system, the super key which will be used includes the productName,
Document Page
(productName, productManufacturer). Although the productName could be used for all the super
keys it will be important to use (productName, productManufacturer) as the super key since the
product would have the same name but they would have different manufacturers and therefore
the need to include it. The unique key to be used in the design will be productName as it will be
the most suitable to identify each of the records in the system (Yu, Qin, and Chang, 2010).
Super Key
productName
(productName, productManufacturer)
Primary Key
productName
Specifying Ranges
For easier searching and sorting of the products with their respective details, it will be important
to use ranges. The most appropriate range to use here is WHERE clause which is a boundary
condition. The reason for choosing this is because one, price range could not be used because it
could not provide specific product information. Two, it will only be possible to select a product
through the use of its name and the name of the manufacturer. Just as explained above, the
names could be the same but the products would be different and there is no way two or more
products would have the same name as well as the manufacturer (Goodrich, Tamassia, and
Mount, 2011). Below is a description:
SELECT ProductName
FROM products
Document Page
WHERE productManfatcurer = ‘K”
Operations to Take Place in The System
Various operations will take place in the system as included in the specification below. First, the
class name of the whole system will be Products. The methods also need to be used in the system
in order to complete the required operations. Below is the description:
Class Name: Products
Methods:
SortingProductType ()
SearchingProductName ()
SearchingProductPrice ()
SearchingProduuctManufacturer ()
FoodExpiryDate ()
Algorithms for the Operations the System Should Support
Product Type Sorting
The first operation which needs to be done by the company system will be searching for the
product name. This will involve the specification of the product type which the customer
whether the household item or food products. The variables used include the:
String productType;
Choice of Algorithm
The algorithm which will be used here is sorting. There are several reasons for choosing this
algorithm. First, there are only two types of products sold by the company including the
household items and the food items. Therefore, considering that the sorting algorithm works
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
good with small number of items, it seemed appropriate to consider this algorithm. Second, this
algorithm is very efficient when it comes to issues of complexity. This is because the methods
the algorithm works better in areas where a little comparison is needed. The algorithm was also
appropriate because of its ability to consume less amount of storage.
Searching Product Name
The variable used here is:
String productName;
For the purpose of the easier location of the product, it is important for every product sold by the
company be recorded into the system so that when the customers want to locate a product, then
they will have an easier time locating the product.
The main algorithm which will be chosen for this scenario would be the binary search. The
method works by splitting the product name into two segments in every situation. This algorithm
is very efficient especially in those situations where the company has a small number of products
to sell. When it comes to the issues of complexity, this algorithm is much better as since even in
the worst case the method is efficient in obeying the given rules.
Searching Product Manufacturer:
The only variable which will be used in this scenario is:
String productManufacturer;
It is very essential that when the customer comes to a store, he or she gets the product which she
wants depending on their manufacturers of choice. The sorting of the manufacturer would just
the same way the searching would be done when searching for a product using the product name.
Therefore, the algorithm which will be used or selected here is binary search. Again, this
Document Page
algorithm was chosen because of the complexity of the searching since the method produced or
was suitable for working on the worst case. Furthermore, the method was suitable for producing
the desired results. This algorithm works by, “repeatedly splitting the array into two segments,
one going from left to mid, and the other going from mid + 1 to right, where mid is the position
halfway from left to right, and where, initially, left and right are the leftmost and rightmost
positions of the array.” This algorithm is efficient in that it will provide an opportunity for
discovering the number of items which have been sorted out from the array within which the
element being searched for is in (Ahn et al., 2015).
Searching Expiry Date
Variable used in this operation include:
expiry date;
The buyers have to know that whatever they are buying from the store is not expired and that it
will not expire on their hands. Therefore, they have to search the product and then the attached
expiry date.
Algorithm Selection
The algorithm which has been selected in the essay is through binary search. This is because the
number of product which requires expiry data is quite small and therefore the use of this
algorithm will be much efficient. When it comes to time and complexity, the algorithm will use
less time and also the algorithm is of low complexity (Velázquez-Iturbide and Debdi, 2011).
Case 2: Second Scenario
From the second case, it can be seen that the number of food items and that of the households has
changed to 1500 and 25,000 respectively. With these changes, there might several items which
Document Page
may be subject to change. This is due to the consideration of size which will make the data
structure as well as the selection of algorithm. Therefore, the algorithms which have been used
previously could not be used in providing the sorting and searching algorithms.
Choice of the variables, Key and Ranges
The main variables of the scenario after merging is still the same due to the same reason
explained above. At the same time, keys and the range still remain the same. Therefore, the
variables, keys, and range are as below:
String productName;
int productPrice;
String productManufacturer;
Date expiryDate:
Key
Super Key
productName
(productName, productManufacturer)
Primary Key
ProductName
Range
SELECT ProductName
FROM products
WHERE productManfatcurer = ‘K”
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
The major operations which will occur in the store inventory
Class Name: Products
The list of the operation will, however, remain the same those in the previous section. This is
because the variables which were present are still the same since only the total size which
changed.
Methods:
SortingProductType ()
SearchingProductName ()
SearchingProductPrice ()
SearchingProduuctManufacturer ()
FoodExpiryDate () (Watt and Brown, 2011)
Selecting the Product Type
In selecting or choosing the product type, the customer will be required to select whether to buy
the food item or household item. The main variable here is:
String productType;
Choice of Algorithms
With a large number of products being sorted by the customers, it will be important to use a
method that will sort the elements much faster and easier. Having that in mind, the best
algorithm will be sorting algorithm (Lafore, 2017).
Product name searching
Document Page
The variable which will be used here is:
String productName;
The main algorithm which will be applied in this section will be quicksort. With the number of
the element which needs to be searched amounting to 26,500 products, the process of sorting
might be much long and complex if the method chosen is cannot handle such a large number.
This method is best used when there is a long list of products which need to be sorted out in the
list. This algorithm works in such a way that one element is chosen to represent the pivotal
chosen, then the sequence of the elements is then divided into three major sequences including
those elements with less value than the pivot element, the final place of the pivot element and
finally the elements with higher values.
Searching Price of the product
The variable here is:
String productPrice;
When it comes to the algorithms which will be used in this paper, it will be important to use the
same algorithm as used in the previous section. Despite the limitation of time usage in searching
for the product prices in the inventory, the algorithm is still the recommendable one due to its
efficiency and consistency. However, since the products are sorted this problem of too much
time consumption will be sorted. Furthermore, this will increase the efficiency which will an
important aspect in developing such a system (Goodrich, Tamassia and, Goldwasser, 2014).
Searching product Manufacture
The variable used here is:
Document Page
String productManufacturer;
This section is just the same as the one above only that the variables are different. At the same
time, the first section has provided a similar case and therefore the paper recommends that the
same search algorithm be used. Therefore, the algorithm to be used here is the binary search
algorithm through the use of the same procedure explained in the first case.
Checking Expiry Date
The variable used here is:
expiry date;
In looking for the expiry date the customer will also be required to go through the same process
as in the first scenario. Therefore, a binary search will also be applied here. One advantage is that
the products will already be sort and therefore the process of locating the expiry date of the
products will be much easier and therefore little time will be used. At the same time, it will be
much more efficient and less complex (Mehlhorn, 2012).
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Reference
McKinney, W., 2010, June. Data structures for statistical computing in python. In Proceedings
of the 9th Python in Science Conference (Vol. 445, pp. 51-56).
Ahn, J.S., Seo, C., Mayuram, R., Yaseen, R., Kim, J.S. and Maeng, S., 2015. Forestdb: A fast
key-value storage system for variable-length string keys. IEEE Transactions on Computers,
65(3), pp.902-915. Mehlhorn, K., 2013. Data structures and algorithms 1: Sorting and
searching (Vol. 1). Springer Science & Business Media.
Goodrich, M.T., Tamassia, R. and Goldwasser, M.H., 2014. Data structures and algorithms in
Java. John Wiley & Sons.
Mehlhorn, K., 2012. Data structures and algorithms 2: graph algorithms and NP-completeness
(Vol. 2). Springer Science & Business Media.
Yu, J.X., Qin, L. and Chang, L., 2010. Keyword search in relational databases: A survey. IEEE
Data Eng. Bull., 33(1), pp.67-78.
Lafore, R., 2017. Data structures and algorithms in Java. Sams publishing.
Watt, D.A. and Brown, D., 2011. Java collections: an introduction to abstract data types, data
structures and algorithms. John Wiley & Sons, Inc.
Goodrich, M.T., Tamassia, R. and Mount, D.M., 2011. Data structures and algorithms in C++.
John Wiley & Sons.
Velázquez-Iturbide, J.Á. and Debdi, O., 2011, April. Experimentation with optimization
problems in algorithm courses. In 2011 IEEE EUROCON-International Conference on
Computer as a Tool (pp. 1-4). IEEE.
chevron_up_icon
1 out of 11
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]