An Antique dealer needs to store records of the items in the inventory into a stack (the dealer believes that keeping items longer will be beneficial; nonetheless, the business logic here is not important!). Besides the usual push() and pop(); the dealer needs to always know what is the most expensive item in the inventory/stack. You are hired to implement a new method, called max(), which returns the current maximum value for any item in the stack. Notice that the stack grows and shrinks dynamically as elements are added or removed from the stack (i.e. the contents of the stack are not fixed).
a. Write the pseudocode of the max() method.
b. What is the Big-O complexity of your solution? Explain clearly how you obtained such complexity.
c. Is it possible to have all three methods (push(), pop() and max()) be designed to have a complexity of O(1)? If no; explain why this is impossible. If yes; provide the pseudocode of the algorithm that would allow O(1) for all three methods
In: Computer Science
Securing Information Systems
Chapter eight in the Laudon text is filled with many examples of how computer systems are vulnerable due to failure, destruction, errors, and abuse. And the never ending onslaught of security breaches continues to escalate despite the lessons learned. It is evident that maintaining good information systems security is a full time endeavor.
By doing a search of the Internet or by other research methods,
find an example of an organization that faced an information
systems security issue or crisis.
Ponder these questions:
1) How did the organization identify that there was a security problem?
2) What, if any, security infrastructure and policies were in place when the problem occurred?
3) What initial actions were taken to deal with the situation?
4) From a management perspective, what, if any, new organizational policies and procedures did they institute?
5) Were any new security tools and technologies eventually implemented to further safeguard their systems?
6) What was the business impact? How did they recover? Were there any legal ramifications, loss of customers, or damage of reputation?
7) Generally speaking, how can a business determine the value of investing in security and control?
In: Computer Science
It is required that this program be written in ARM Assembly using raspberry pi. Submit an ARM assembly program that does the following:
1. Prompt for the user to enter a number (integer).
2. If the entered number is <100 print: "The input number is less than 100."
3. If the entered number is >=100 print: "The input number is greater than or equal to 100."
4. Prompt for the user to enter a single character.
5. If the entered character is lower case (a..z) print: "Lower case letter entered."
6. If the entered character is upper case (A..Z) print: "Upper case letter entered."
7. Otherwise print: "Special character entered." 8. Return control to the operating system.
I SEE THIS QUESTION HAS BEEN POSTED IN THE PAST AND NEVER RECEIVED A CORRECT ANSWER. THIS PROGRAM MUST BE WRITTEN IN ARM ASSEMBLY USING THE ARM PROCESSOR FOUND ON A RASPBERRY PI. IT CAN ALSO BE WRITTEN USING THE RASPBERRY PI EMULATOR THAT CAN BE FOUND ONLINE FOR FREE. PLEASE DO NOT POST THE ANSWER IN A DIFFERENT PROGRAMMING LANGUAGE. THANK YOU!
In: Computer Science
Suggest ideas for an interface, which uses the properties of sound effectively.
In: Computer Science
"This C Programming "
Write a program that accepts four (4) lines of input:
• The first line contains a float value in 4.2f format
• The second line contains a char value
• The third line contains a 4-digit int value
• The fourth line contains a char value
and then displays all of the input on a single line
Write a program that accepts a phone number of the form +1(xxx)-xxx-xxxx
where x is a digit, and displays the sum of all digits in the phone number.
In: Computer Science
n this exercise, you create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local companies. Figure 7-53 shows the charge for attending a seminar. Notice that the charge per person depends on the number of people the company registers. For example, the cost for four registrants is $400; the cost for two registrants is $300. The program should allow the sales manager to enter the number of registrants for as many companies as needed. When the sales manager has finished entering the data, the program should calculate and display the total number of people registered, the total charge for those registrants, and the average charge per registrant. For example, if one company registers four people and another company registers two people, the total number of people registered is six, the total charge is $700, and the average charge per registrant is $116.67. Number of people a company registers . Charge per person ($)
1 – 3 150
4 – 9 100
10 or more 90
fig 7-53
a.Create an IPO chart for the problem, and then desk-check the algorithm appropriately.b.List the input, processing, and output items, as well as the algorithm, in a chart similar to the one shown earlier in Figure 7-42. Then code the algorithm into a program.c.Desk-check the program using the same data used to desk-check the algorithm.d.If necessary, create a new project named Advanced25 Project, and save it in the Cpp8\Chap07 folder. Enter your C++ instructions into a source file named Advanced25.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Display the average charge with two decimal places
In: Computer Science
Assume that the monthly profits of a company are given in an
array, each entry representing
the profits for the corresponding month. Propose an algorithm to
find a group of consecutive
months where the profit was the highest.
For example, the profits, in millions, for a year Jan-Dec is given
by
A=[2 -5 3 4 0 -1 5 8 -9 1 -2 0];
The highest profit was from the period March-August and the value
is 19 million. Assume
that the array can be very large{not just 12 months. Submit a well
comment c++ pseudocode
along
with an example of the algorithm
Solve for algorithms with complexity O(n)
In: Computer Science
I don't know which one is wrong. Can you please check.
Thank you
QUESTION 1
In the following code, how many and which functions have been defined/declared?
def powerNum(power):
pNum = n ** power
return pNum
n = int(input("Enter a number whose power you want to calculate: "))
def main():
p = int(input("Enter the power number: "))
print ("Power of the number you entered is", powerNum (p))
main()
1 function: powerNum |
||
1 function: powerNum |
||
3 functions: powerNum, and main is defined/declared twice. |
||
2 functions: powerNum and main |
QUESTION 2
In the following code, which of the variable(s) is (are) considered as global variable(s):
def powerNum(power):
pNum = n ** power
return pNum
n = int(input("Enter a number whose power you want to calculate: "))
def main():
p = int(input("Enter the power number: "))
print ("Power of the number you entered is", powerNum (p))
main()
p and power |
||
pNum |
||
p |
||
power |
||
n |
QUESTION 3
In the following code, which line of code is returning the value for function powerNum?
def powerNum(power):
pNum = n ** power
return pNum
n = int(input("Enter a number whose power you want to calculate: "))
def main():
p = int(input("Enter the power number: "))
print ("Power of the number you entered is", powerNum (p))
main()
def powerNum(power): |
||
print ("Power of the number you entered is", powerNum (p)) |
||
return pNum |
||
pNum = n ** power |
QUESTION 4
In the following code, which of the variable(s) is (are) considered as parameter variable(s):
def powerNum(power):
pNum = n ** power
return pNum
n = int(input("Enter a number whose power you want to calculate: "))
def main():
p = int(input("Enter the power number: "))
print ("Power of the number you entered is", powerNum (p))
main()
n |
||
pNum |
||
p and power |
||
p |
||
power |
QUESTION 5
After learning about the issues with global variables, Amita took the old code with global variables in cell A and re-wrote without global variables. Based on the partial code done in the cell below, what changes, if any, need to be made to the code in cell-B below?
cell-A: Old code with global variables | cell-B: Partial new code without global variables |
def powerNum(power): pNum = n ** power return pNum n = int(input("Enter a number whose power you want to calculate: ")) def main(): p = int(input("Enter the power number: ")) print ("Power of the number you entered is", powerNum (p)) main() |
def powerNum(power): pNum = n ** power return pNum def main(): n = int(input("Enter a number whose power you want to calculate: ")) p = int(input("Enter the power number: ")) print ("Power of the number you entered is", powerNum (p)) main() |
We need to just change powerNum function to accept two parameters: one for power value and one for the number as below def powerNum(power, n): |
||
No changes need to be made to main or powerNum functions |
||
Yes, powerNum should now be defined with two parameters: one for power value and one for the number as below def powerNum(power, n): Also we will need to change how the function is called in main function as below: powerNum(p,n) |
||
We need to just pass the additional argument when the powerNum function is called in main function as below: powerNum(p,n) |
QUESTION 6
In the following code, which line of code is calling or invoking function powerNum?
def powerNum(power):
pNum = n ** power
return pNum
n = int(input("Enter a number whose power you want to calculate: "))
def main():
p = int(input("Enter the power number: "))
print ("Power of the number you entered is", powerNum (p))
main()
return pNum |
||
def powerNum(power): |
||
pNum = n ** power |
||
print ("Power of the number you entered is", powerNum (p)) |
QUESTION 7
In the following code, which line of code is defining or declaring function powerNum?
def powerNum(power):
pNum = n ** power
return pNum
n = int(input("Enter a number whose power you want to calculate: "))
def main():
p = int(input("Enter the power number: "))
print ("Power of the number you entered is", powerNum (p))
main()
def powerNum(power): |
||
return pNum |
||
pNum = n ** power |
||
print ("Power of the number you entered is", powerNum (p)) |
QUESTION 8
In the following code, which of the variable(s) is(are) considered as argument(s):
def powerNum(power):
pNum = n ** power
return pNum
n = int(input("Enter a number whose power you want to calculate: "))
def main():
p = int(input("Enter the power number: "))
print ("Power of the number you entered is", powerNum (p))
main()
p and power |
||
n |
||
power |
||
p |
||
pNum |
QUESTION 9
In python, how can you pass arguments to a function?
by keyword arguments only and can be in any order |
||
default is by position but you can also pass by keyword arguments as in the case below: show_interest (rate=0.01, periods=10, principal=10000.0) |
||
by position only and they must be passed in the same order in which they are defined in the function header |
||
by position only and they can be passed in any order irrespective of how are they are defined |
QUESTION 10
In the following code, in which order do the lines of code get executed?
def powerNum(power):
pNum = n ** power
return pNum
n = int(input("Enter a number whose power you want to calculate: "))
def main():
p = int(input("Enter the power number: "))
print ("Power of the number you entered is", powerNum (p))
main()
getting input n from the user >> calling main function >> calling powerNum function >> ending in powerNum function |
||
calling powerNum function >> getting input n from the user >> calling main function |
||
getting input n from the user >> calling main function >> calling powerNum function >> returning back to main function from powerNum function |
In: Computer Science
C Programming Please write a single function and not the whole program
Can you please provide comments and explanations for all questions. Thank you
Write a single function for the following:
void split_date(int day_of_year, int
year, int *month, int *day);
day_of_year is an integer between 1 and 366, specifying a particular day within the year
designated by the parameter year.
Month and day point to variables in which the function
will store the equivalent month (1 – 12) and day within the month
(1 – 31)
The question is trying to ask you to write a single function in C that takes a day of the year (1-366) and calculates which month and which day of the month corresponds to that day of in the month. So a day of the year of let's 15 would return 1 (for the month - January) and 15 for the day of the month. The second parameter (year) is needed because leap years have 366 days and non-leap years have 365 days.
In: Computer Science
SQL is our language for relational databases - do you think it's an adequate "language" for database creation and manipulation?
In: Computer Science
Discuss the use of artificial intelligence in automation of tasks in accounting giving 3
pertinent examples. Need to be 520 word
In: Computer Science
A sequence of integers x1,x2,...,xn is unimodal if for some 1 ≤ i ≤ n we have x1 < x2 < ... < xi and xi > xi+1 > ... > xn. Find the maximum element in a unimodal sequence of integers x1, x2, . . . , xn. The running time should be O(log n). Show that your algorithm meets the bound.
In: Computer Science
Consider the following scenario and design a C++ program using an output stream file: A person invests $1,000 on a savings account yielding 5% interest. Assuming that all the interest is left on deposit, calculate and print the amount of money in the account at the end of each year for 10 years. Use the following formula to determine the amounts: a = p (1 + r)n where p is the original amount invested (i.e., the principal) r is the annual interest rate (e.g., use 0.05 for 5%)f n is the number of years a is the amount on deposit at the end of the nth year. Your program must have an output file to display your results.
In: Computer Science
Under System requirement provide a detail overall description, product perspective, Memory Constraint, user interface, Site adaptation Requirements and Operations of building a HBCU Database Hub/Center.
In: Computer Science
python programming.
Write a program that prompts the user to enter an integer from 0 to 9. The program will check if the input is a positive integer. It displays the correct answer and shows the guess is correct or not. The demos are shown as following.(Hint:1. Use a random math function 2. Use str.isdigit() to check the input)
In: Computer Science