Explain the OSI model with examples of each layer.
In: Computer Science
Write a C++ program to test if a given array satisfies the constraints of min heap and max heap.
bool isMinHeap(int arr[],int size); bool isMaxHeap(int arr[],int size);
Also write code for this function:-
int heapPlay(int arr[],int size);
The function returns an integer as follows:-
1. If the array is a min heap return the minimum element
2. If the array is a max heap return maximum element
3. Return 0, if the array is a min heap and a max heap
4. Return -1, if the array is neither a min heap nor a max heap
Ex.
Input - Contains size on line 1, an array on line 2.
Output - We will test your three methods
Input -
3
1 2 3
Output -
isMinHeap -> true
isMaxHeap -> false
heapPlay -> 1
Sample Input 1:
1 5
Sample Output 1:
1 1 0
Sample Input 2:
3 9 8 7
Sample Output 2:
0 1 9
template:
bool isMinHeap(int arr[],int size)
{
//code here
}
bool isMaxHeap(int arr[],int size)
{
//code here
}
int heapPlay(int arr[],int size)
{
//code here
}
In: Computer Science
Scenario 4
A warehouse has a new leadership team and they wanted to prove their performance was as good or better than the previous leadership team. They measured on-time shipping and accurate order fulfillment. Their data showed a correlation value of 0.70 and a regression value of 0.49 between on-time shipping and accurate order fulfillment. The previous leadership teams’ corresponding numbers for on-time shipping and accurate order fulfillment were a correlation value of 0.80 and a regression value of 0.64.
1. What conclusions can you summarize from these numbers in plain English?
2. Based on this data what future course of action do you recommend for your client?
Scenario 5
The same warehouse leadership team in Scenario 4 measured damaged products and warehouse capacity. Their data showed a correlation value of -0.50 and a regression value of 0.25 between damaged products and warehouse capacity.
1. What conclusions can you summarize from these numbers in plain English?
2. Based on this data what future course of action do you recommend for your client?
In: Math
Write a C++ program, tictac.cpp, that repeatedly reads in tic-tac-toe boards and for each one indicates if there is a winner and who won.
The board will be read in as 3x3 array of characters (x, o or . for a blank spot).
You are required to write the following functions to help solve the problem:
// input prompts the user for a board and inputs it
// into the given array
void input (char board [3][3]);
// print prints the board in nice format
void print (char board [3][3]);
How it should look:
Enter your board as characters (x, o or .):
o.x
..o
.x.
The board is:
o | | x
-----------
| | o
-----------
| x |
No winner!
Would you like to do another (y or n)? y
Enter your board as characters (x, o or .):
oxo
ox.
.xo
The board is:
o | x | o
-----------
o | x |
-----------
| x | o
X wins!
Would you like to do another (y or n)? y
Enter your board as characters (x, o or .):
xoo
xox
ox.
The board is:
x | o | o
-----------
x | o | x
-----------
o | x |
O wins!
Would you like to do another (y or n)? n
Thanks for playing!
// win returns true if the given player has won on the
// given board, else it returns false
bool win (char board [3][3], char player);
You are required to use nested loops to write the functions input and print.
The back of this page shows a sample run of the program (input in bold). Your output should look at least as nice as that shown. You may assume that the board will be legal and there will be at most one winner.
In: Computer Science
Please type!
What is the most important think you learned about Green Buildings, Sprawl, and Sustainability Initiatives from the textbook? like a summary of it.
In: Other
I am wondering whether the five1 units of the natural unit system really is dictated by nature, or invented to satisfy the limited mind of man? Is the number of linearly independent units a property of the nature, or can we use any number we like? If it truly is a property of nature, what is the number? -five? can we prove that there not is more?
In the answers please do not consider cgs units, as extensions really is needed to cover all phenomenon. - or atomic units where units only disappear out of convenience. - or SI units where e.g. the mole for substance amount is just as crazy as say some invented unit to measure amount of money.
In: Physics
Sound source A is located at x = 0, y = 0, and sound source B is located at x = 0, y = 2.0 m. The two sources radiate coherently and in phase. An observer at x = 15.8 m, y = 0 notes that as he takes a few steps from y = 0 in either the +yor −y-direction, the sound intensity diminishes. What is the lowest frequency, and the next to the lowest frequency of the sources that can account for that observation? (Enter your answers from smallest to largest.)
kHz
kHz
In: Physics
A dilute solution of hydrochloric acid with a mass of 607.23 g
and containing 0.33131 mol of HCl was exactly neutralized in a
calorimeter by the sodium hydroxide in 614.70 g of a comparably
dilute solution. The temperature increased from 15.848 to 19.739
°C. The specific heat of the HCl solution was 4.031
J·g-1·°C-1; that of the NaOH solution was
4.046 J·g-1·°C-1. The heat capacity of the
calorimeter was 77.99 J·°C-1.
Enter the balanced equation for the reaction. Include states in
your answer.
Use the data above to calculate the heat evolved. What is the
heat of neutralization per mole of HCl? Assume that the original
solutions made independent contributions to the total heat capacity
of the system following their mixing.
ΔH = ___ kJ/mol
In: Chemistry
. Design a square footing for a 16-in. square interior column with an ultimate dead load = 300 (k) and an ultimate live load = 200 (k). Take fy=60,000 psi, fc=4000 psi, normal weight, and qa= 4500 psf. Assume the base of the footing is 4 (ft.) below grade. Draw the reinforcement detail also. Check for one way and two way shears with the support of diagram. With ACI code
In: Civil Engineering
In: Economics
Consider the following assets available for investment:
1. A stock index fund
2. A corporate bond fund
3. A utility fund
4. A global fund
5. A treasury fund
You have research on the funds that has projected out the expected returns (in percent) for the funds
along with the probabilities of those returns occurring. The following table shows the expectations:
| probability | SIF | CBF | UF | GF | TF | |
|---|---|---|---|---|---|---|
| Rec | .15 | -18 | 5 | -5 | -20 | 3 |
| N Rec | .2 | -7 | 3 | -3 | -10 | 3 |
| norm | .3 | 12 | 6 | 5 | 15 | 3 |
| n boom | .2 | 20 | 2 | 10 | 25 | 3 |
| boom | .15 | 25 | -1 | 15 | 35 | 3 |
Your assignment is to analyze the risk and return metrics of these assets and answer the following questions:
1. What is the expected return of each asset?
2. What is the standard deviation of each asset?
3. What is the Sharpe Ratio of each asset, using the treasury fund as the risk free asset? (Note, the treasury fund will not have Sharpe ratio because it is the risk free asset)
4. Using the stock index fund as the “market”, what is the Beta of each asset?
5. If you were only going to invest in one of these assets, would it be more appropriate to use standard deviation or Beta as your measure of risk, and why?
6. Which asset, if held as a single investment, gives you the best reward for the risk you have taken?
7. Diagram the Security Market Line (assuming the stock index fund is the market and the treasury fund is the risk free asset), plotting the assets in their appropriate places.
8. Which assets are considered “underpriced” and which are considered “overpriced” based on the SML?
In: Finance
Program a calculator or computer to use Euler's method to compute y(1), where y(x) is the solution of the given initial-value problem. (Give all answers to four decimal places.)
dy/dx+ 3x2y = 12x2,
y(0) = 5
| h = 1 | y(1) = |
| h = 0.1 | y(1) = |
| h = 0.01 | y(1) = |
| h = 0.001 | y(1) = |
In: Computer Science
c++
1 city.h
#pragma once
#ifndef CITY_H
#define CITY_H
#include<string>
#include<iostream>
#include<utility>
using namespace std;
class City {
public:
City(string nm, unsigned int pop) {
namePopulationPair = make_pair(nm, pop);
}
bool operator<(const City &city)const {
if (this->getName() < city.getName()) {
return true;
}
else {
return false;
}
}
void setName(string name) { namePopulationPair.first = name; }
void setPopulation(unsigned int population)
{
namePopulationPair.second = population;
}
string getName() const { return namePopulationPair.first; }
unsigned int getPopulation() const { return namePopulationPair.second; }
virtual void printInfo() const {
cout << getName() << ": " << getPopulation() << endl;
}
protected:
pair<string, unsigned int> namePopulationPair;
};
#endif
Use city.h from the previous lab without any modifications.
2 main.cpp
In main.cpp do the following step by step:
1. Globally define array cityArray[] consisting of cities with the following details:
(a) Los Angeles with population of 4 million
(b) San Diego with population of 1.5 million
(c) San Francisco with population of 900 thousand
(d) Sacramento with population of 500 thousand
(e) Stockton with the population of 300 thousand
(f) Redding with the population of 90 thousand
(g) Las Vegas with the population of 700 thousand
(h) Reno with the population of 300 thousand
(i) Portland with the population of 700 thousand
(j) Seattle with the population of 750 thousand
(k) Eugene with the population of 200 thousand
2. Globally define a vector of City objects, without initial values. Call it cityVector (1 points).
3. Pass vectors to these functions as reference, and define them as constant if the functions are not
allowed to modify them.
(a) Define function void initVector(...) that receives a vector of City objects, an array
of elements of type City as a second input, and an integer as its third input. The third input
represents the number of elements in the input array. Initialize the input queue with the elements
existing in the input array (2 points).
(b) Define function void printCityVector(...) that receives a vector of City objects
as input and prints the elements within the vector. Hint: You can use range-based for loops (2
points).
(c) Define function int mergeCityVector(...) that receives a vector of City objects as
input, along with three integers as indexes that represent the lower bound, the division point of
the vector into two halves, and the upper bound within the vector. It merges the two halves of
the vector (assuming they are sorted) according to the city populations (5 points).
(d) Define function void cityMergeSort(...) that receives a vector of City objects as
input, along with two integers as indexes that represent the lower and upper boundaries within
the vector. It does merge sort on the vector of City objects according to the city populations
(by invoking the mergeCityVector() function on sorted vectors (5 points).
In main() function do the following step by step, using the functions defined above:
(i) Initialize cityVector according to array cityArray[] using the function defined above (1
points).
(ii) Print out the entries of cityVector, using the appropriate function defined above (1 points).
(iii) Do merge sort on cityVector and print out the updated vector. (1 points).
The output of the program may look like the following:
Initializing cityVector with cityArray[]:
Los Angeles: 4000000
San Diego: 1500000
San Francisco: 900000
Sacramento: 500000
Stockton: 300000
Redding: 90000
Las Vegas: 700000
Reno: 300000
Portland: 700000
Seattle: 750000
Eugene: 200000
Merge sort on cityVector:
Redding: 90000
Eugene: 200000
Stockton: 300000
Reno: 300000
Sacramento: 500000
Las Vegas: 700000
Portland: 700000
Seattle: 750000
San Francisco: 900000
San Diego: 1500000
Los Angeles: 4000000
2
In: Computer Science
1. Complete the balance sheet for the business for 2016 and 2017.
2. In which year do you think the balance sheet is better?
|
2016 |
2017 |
|||||
|
Fixed Assets |
||||||
|
Premises |
60,000 |
74,000 |
||||
|
Equipment |
14,000 |
24,000 |
||||
|
Current Assets |
||||||
|
Stocks |
2,000 |
3,000 |
||||
|
Debtors |
5,000 |
3,000 |
||||
|
Cash at Bank |
5,000 |
2,000 |
||||
|
Current Liabilities |
||||||
|
Overdraft |
3,000 |
3,000 |
||||
|
Creditors |
3,000 |
3,000 |
||||
|
Working Capital |
||||||
|
Net Assets |
||||||
|
Financed by: |
||||||
|
Owners Capital |
40,000 |
65,000 |
||||
|
Loan |
40,000 |
35,000 |
||||
|
Capital Employed |
||||||
In: Accounting
1. What is oxidation? How do you know if a molecule/atom has undergone oxidation.
2. Describe the reactivity of alcohols (1˚, 2˚, and 3˚) to oxidation.
3. What are two ways besides IR that we can determine if we have the right product? Please explain what molecular property is measured and how borneol and camphor will show up differently in the technique.
4. When we take the IR of borneol and camphor, how will the spectra look different?
5. Why is the Camphor reaction considered “green”?
In: Chemistry