Questions
Write a program named “hw2-extra.py” that will find duplicate numbers in an array.Here is a sample...

Write a program named “hw2-extra.py” that will find duplicate numbers in an array.Here is a

sample run of the program. An example for an input is as follows. The program tells you “The

7

duplicate numbers: 2 3 7 1”.

Again, do not use built-in functions if there is any.

You can read

the input from the file named as “hw2-ExtraCredit.txt”

235231779 13 15 99 96 4 1

The duplicate numbers: 2 3 1 7

In: Computer Science

a) Explain differential movement and prevention in brick and concrete masonry. Where the control joints are...

a) Explain differential movement and prevention in brick and concrete masonry. Where the control joints are must be located.

b) A 150 –ft exterior clay brick wall is designed for ½ -in expansion joints and a joint compressibility of 40 %. Determine the maximum joint spacing and the minimum number of joints required for entire wall. (Wall is going to be built in Lubbock TX. Temperature difference can be taken as 80ºF. Annual mean relative humidity is moderate 75>AMRH>50)

In: Civil Engineering

Q1: what does the efficient frontier represents? Q2: how do we estimate the return and standard...

Q1: what does the efficient frontier represents?

Q2: how do we estimate the return and standard deviation of a newly built portfolio from analyzing the stocks in that portfolio?

Q3: in the regression equation, what is meant by a regression that has an R-square with 0.95 and how does it compare with a regression with a R-square of 0.30?

Q4: why do we use adjusted beta?

Q5: what is the information ratio and why do we use it?

In: Finance

Which of the following is true?a. Catabolism is degradative, in which organic molecules areconverted...

Which of the following is true?

a. Catabolism is degradative, in which organic molecules are converted into smaller, simpler end products with the consumption of energy.

b. Anabolism is degradative, in which organic molecules are converted into smaller, simpler end products with the consumption of energy.

c. Catabolism is degradative, in which organic molecules are converted into smaller, simpler end products with the release of energy.

d. Catabolism is synthetic, in which small simple precursors are built up into organic molecules with the consumption of energy.

e. Anabolism is synthetic, in which small simple precursors are built up into organic molecules with the release of energy.

Which of the following is true?

a. Enthalpy, H, is the heat content of the reacting system. If a reaction consumes heat is it called exothermic, because it is taking heat from its external surroundings.

b. Entropy, S, is a quantitative expression for the order in a system. The universe tends to move away from entropy.

c. Gibbs free energy, G, expresses the amount of energy available to do work. The temperature and pressure are not relevant.

d. Enthalpy, H, is negative when a reaction is exothermic, because the reaction is releasing heat.

e. Gibbs free energy, G, is positive when a reaction is thermodynamically favorable because it takes energy to make reactions proceed.


In: Biology

This question demonstrates the use of inheritance and polymorphism. Design a Ship class that has the...

This question demonstrates the use of inheritance and polymorphism.
Design a Ship class that has the following members:
• A field for the name of the ship (a string).
• A field for the year that the ship was built (a string).
• A constructor and appropriate accessors and mutators.
• A toString method that overrides the toString method in the Object class. The Ship class
toString method should display the ship’s name and the year it was built.
Design a CruiseShip class that extends the Ship class. The CruiseShip class should have the following members:
• A field for the maximum number of passengers (an int).
• A constructor and appropriate accessors and mutators.
• A toString method that overrides the toString method in the base class. The CruiseShip class’s
toString method should display only the ship’s name and the maximum number of passengers.
Design a CargoShip class that extends the Ship class. The CargoShip class should have the following members:
• A field for the cargo capacity in tonnage (an int).
• A constructor and appropriate accessors and mutators.
• A toString method that overrides the toString method in the base class. The CargoShip class’s
toString method should display only the ship’s name and the ship’s cargo capacity.
Demonstrate the classes in a program that has a Ship array. Assign various Ship, CruiseShip, and CargoShip objects to the array elements. The program should then step through the array and print each object.

In: Computer Science

A regression model of the form y = beta0 + beta1 x1 + beta2 x2 +...

A regression model of the form

y = beta0 + beta1 x1 + beta2 x2 + beta3 x3 + E

was built using 20 observations. Partially completed regression output tables are provided below. What are the values of A, B, and C?

Table 1

Statistic

Value

R-Square

A

Adjusted R-Square

B

Standard Error (RMSE)

C

n

20

Table 2

Source

DF

SS

MS

F

P-Value

Regression

D

175

H

J

K

Error

E

G

I

Total

F

250

A regression model of the form

y = beta0 + beta1 x1 + beta2 x2 + beta3 x3 + E where E is assumed to be normal with mean 0 and constant variance.

was built using 20 observations. Partially completed regression output tables are provided below. What are the values of D, E, and F?

Table 1

Statistic

Value

R-Square

A

Adjusted R-Square

B

Standard Error (RMSE)

C

n

20

Table 2

Source

DF

SS

MS

F

P-Value

Regression

D

175

H

J

K

Error

E

G

I

Total

F

250

In: Statistics and Probability

Part A - For Loops (7 Marks) Charlie, an avid mountain biker, has purchased a new...

Part A - For Loops

Charlie, an avid mountain biker, has purchased a new multisport watch that measures data such as horizontal position, time, heart rate and elevation. The associated software for the watch allows for users to design their own apps that record new measurements. Charlie is interested in measuring their elevation gain and total distance travelled.

1. Write a MATLAB function that recieves vectors for horizontal position and elevation and outputs a plot of elevation vs. horizontal position. (1 mark)

2. Write a function that receives the vectors for horizontal position and elevation and outputs total distance travelled. You can assume that each point has been recorded sufficiently close together that a linear approximation incurs insignificant error. Your solution must use a for loop and is not allowed to use the in-built sum or diff functions. Hint: Calculate the distance between each coordinate and sum these distances together.

3. Elevation gain is a term used to describe the total vertical distance climbed up during uphill sections (downhill elevation changes are ignored). Write a function that receives an elevation vector and calculates the total elevation gain for the trip. Your solution must use a for loop and is not allowed to use the in-built sum or diff functions.

In: Computer Science

Python: Write a function that receives a one dimensional array of integers and returns a Python...

Python:

Write a function that receives a one dimensional array of integers and returns a Python tuple with two values - minimum and maximum values in the input array. You may assume that the input array will contain only integers and will have at least one element. You do not need to check for those conditions.

Restrictions: No built-in Python data structures are allowed (lists, dictionaries etc). OK to use a Python tuple to store and return the result.

Below is the starter skeleton code for this problem, on which the implementation must be built. Methods defined in the skeleton code must retain their names and input / output parameters. Variables defined in skeleton code must also retain their names.

from a1_include import

*def min_max(arr: StaticArray) -> ():

"""

TODO: Write this implementation

"""

return 0, 0

# BASIC TESTING

if __name__ == "__main__":

# example 1

arr = StaticArray(5)

for i, value in enumerate([8, 7, 6, -5, 4]):

arr[i] = value

print(min_max(arr))

# example 2

arr = StaticArray(1)

arr[0] = 100

print(min_max(arr))

# example 3

arr = StaticArray(3)

for i, value in enumerate([3, 3, 3]):

arr[i] = value

print(min_max(arr))

In: Computer Science

A bond with a face value of $1000 and maturity of exactly 20 years pays 10%...

A bond with a face value of $1000 and maturity of exactly 20 years pays 10% annual coupon. This bond is currently selling at an annual yield-to-maturity (YTM) of 12%. Answer the following questions for this bond.

a. Calculate the current price of the bond by discounting all the cash flows of the bond using the timeline method. b. Calculate the modified duration of the bond without using any Excel built-in function. (calculate PV of each cash flow, find the weight of each cash flow and then multiply time with the weight) c. Using modified Duration, calculate what would be the new price of the bond when YTM is 11%. d. Using modified Duration, what is the percentage change in price from the original level (found in part a) when YTM is 11%? e. Calculate convexity of the bond without using any Excel built-in function. f. Using the modified duration plus convexity model, what is the new price of the bond when YTM is 13%? g. Using the modified duration plus convexity model, what is the percentage price change from the original level (found in part a) of the bond when YTM is 13%.

Please only answer parts E,F & G

In: Finance

Provide the optimal Solution to the problems below using java code and include Time Complexity Analysis!...

Provide the optimal Solution to the problems below using java code and include Time Complexity Analysis!

  1. Peaks and Valleys

In an Array of integers, a “peak” is an element which is greater than or equal to the adjacent integers and a “valley” is an element which is less than or equal to the adjacent integers. For example, the array {5, 8, 6, 2, 3, 4, 6}, {8, 6} are peaks and {5, 2} are valleys. Give an array of integers, sort the array into an alternating sequence of peaks and valleys.

EXAMPLE

INPUT:

                                {5, 3, 1, 2, 3}

                OUTPUT:

{5, 1, 3, 2, 3}

  1. Build Order

You are given a list of projects and a list of dependencies (Which is a list of pairs of projects, where the second project is dependent on the first project). All of a project’s dependencies must be built before the project is. Find a build order that will allow the projects to be built. If there is no valid build order, return an error.

EXAMPLE

                INPUT:

                                Projects: a, b, c, d, e, f

                                Dependencies: (a, d), (f ,b), (b, d), (f, a), (d, c)

                OUTPUT:

f, e, a, b, d, c

(I need java code with explanation of algorithms and time complexity)

In: Computer Science