Question

In: Computer Science

1. Suppose that a software developer is creating a program to store lists of supermarket products....

1. Suppose that a software developer is creating a program to store lists of supermarket products. Each product has a code made up of the digits 0 and 1, for example 010011010000, and an availability, either yes or no. Further suppose that the software developer decides to store the lists in base-10, believing that base-10 will simplify calculations. Briefly explain why this is a bad idea.  

Solutions

Expert Solution

  • Below is the detaled explanation of the above mentioned problem.
  • So a software developer wants to store a list of supermarket products which are made up of code in binary(i.e, string of 0's and 1's) and a availability(which is a boolean value), but if the developer decides to store the list in base-10 that can be very inefficient.
  • As the binary strings can be very large it is very difficult to store those values in base-10 as in most of the languages we do not have a datatype that can support integers having more than 64 bits.
  • As these days every computer supports 64 bit architecture so it is the max limit to store integers in most of the languages.
  • In some languages like python higher bits integers can also be stored but it is a time consuming process to store very large integers and peforming some calculations on them.
  • Consider an example , let the code of a product be a string of length 10^5 (consisting of 0's and 1's) and we now convert this to base-10 , now it is impossible to store these in basic datatypes(int, long long) in most of the languages like C, C++, java as they do not have that much limit but yes we can store them using python but performing calculations on a string of length 10^5 is very very faster than on a base-10 converted integer.
  • In C/C++, 10^8 operations are performed in 1sec(2 in java and 5 in python) so it is very faster then converting it in base-10 and then dealing with it.

So there is both storage issue and time complexity also increases , so it is a bad idea to convert binary string to base-10 for long string.

So if you still have any doubt regarding this solution please feel free to ask it in the comment section below and if it is helpful then please upvote this solution, THANK YOU.


Related Solutions

Suppose that a software developer is creating a program to store lists of supermarket products. Each...
Suppose that a software developer is creating a program to store lists of supermarket products. Each product has a code made up of the digits 0 and 1, for example 010011010000, and an availability, either yes or no. Further suppose that the software developer decides to store the lists in base-10, believing that base-10 will simplify calculations. Briefly explain why this is a bad idea.
RUN THIS PROGRAM ON NETBEANS As a Software Developer, you have received a requirement from a...
RUN THIS PROGRAM ON NETBEANS As a Software Developer, you have received a requirement from a Company to implement a prototype for its payroll system. You receive the following specifications: If an employee works more than its regular hours, it is considered overtime and it will be paid based on the employee’s experience. All employees are paid biweekly (80 hours) Employee taxes: 1% This company manages three categories of workers based on employee’s experience. Group 1 (Silver) o Pay rate:...
Choice 1. You are the new software developer at work. You are brought into a meeting...
Choice 1. You are the new software developer at work. You are brought into a meeting with clients that do not understand the idea of sorting data. Now you know, that you cannot use complex math to explain, but you can illustrate in diagrams. Basically, this group has been working with unsorted data and you must explain why their searches and reports will be so much faster with sorted data. You do not know anything specific about their data, but...
1.In computing terminology, the method of opening an application program and then creating a document is...
1.In computing terminology, the method of opening an application program and then creating a document is known as the ____-centric approach. a.data b.application c.document d.user 2.When you save a WordPad document, it is stored in the main memory (____) of the computer. a.RAM b.REM c.RIM d.ROM 3.The method of first creating a blank document directly in the Documents library and then use the WordPad program to enter data into the document is called the ____- centric approach. a.data b.application c.document...
1.Ginny downloads and modifies an open source software program, then uploads the program with a different...
1.Ginny downloads and modifies an open source software program, then uploads the program with a different name. which type of software license is she most likely to be working under? 2. which of the following is an example of financial management software? 3. image-editing software allows you to? 4. digital audio software can be used to? 5. when you subscribe to software, no license is necessary. true or false.
1.Ginny downloads and modifies an open source software program, then uploads the program with a different...
1.Ginny downloads and modifies an open source software program, then uploads the program with a different name. which type of software license is she most likely to be working under? 2. which of the following is an example of financial management software? 3. image-editing software allows you to? 4. digital audio software can be used to? 5. when you subscribe to software, no license is necessary. true or false.
Task 1. creating a nested if:   Need a python program that ask the user to enter...
Task 1. creating a nested if:   Need a python program that ask the user to enter the annual income of an employee and the years of experience. Pass these data to a function. The function decides if an employee does qualify for a loan or does not, then it prints a message based on the following rules: If the income is equal or greater than $40000, the function checks if the employee's years of experience is greater than 4, if...
Write a program that uses linked lists in order to support the following operations: 1. PUSH...
Write a program that uses linked lists in order to support the following operations: 1. PUSH (S, x) - pushes a value x into a stack S 2. POP (S, i) - gets a number i (positive integer) and pops i numbers of S. If S contains less than i values, the operation is impossible to execute (program prints ERROR in this case – see below). 3. REVERSE (S) - reverse the order of the elements in S (you might...
1. A "sniffer" is a software program that records information that passes through a computer or...
1. A "sniffer" is a software program that records information that passes through a computer or a connected router. If you owned an e-business with multiple employees would you use a sniffer? Why or why not?   2. If you were going to use a sniffer program, would you notify employees about it? Why or why not?
1.Suppose that the number of customers who enter a supermarket each hour is normally distributed with...
1.Suppose that the number of customers who enter a supermarket each hour is normally distributed with a mean of 670 and a standard deviation of 180. The supermarket is open 17 hours per day. What is the probability that the total number of customers who enter the supermarket in one day is greater than 10100? (Hint: Calculate the average hourly number of customers necessary to exceed 10100 in one 17-hour day.) 2.Assume that women's weights are normally distributed with a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT