Questions
Jojo the wizard is currently on a dragon’s lair. To escape from the lair, Jojo needs...

Jojo the wizard is currently on a dragon’s lair. To escape from the lair, Jojo needs to defeat the elder dragon. Jojo is currently a wizard under training, so he knows only one spell : the fireball spell. The dragon’s body can be represented as an array of size N , where each part of the dragon’s body, from its head to its tail, is numbered with integer from 1 to N. Each body part has its sensitivity to fire a i . If a i is positive, then the fireball spell will deal a i damage to the dragon. If a i is negative, it will heal the dragon by − a i health points instead. The fireball spell is a spell which deals damage to the dragon’s body on exactly K consecutive body parts. That is, if Jojo casts the spell on i-th body part, then the fireball will attack the parts [i, i+1, i+2, ..., i + K −1]. For example, if the dragon’s body is [1 , 2 , − 2 , 4 , 5], and K is 3, then Jojo may cast the spell on 1st, 2nd, and 3rd body part, which deals 1, 4, and 7 damage respectively. Jojo can’t cast the spell on 4 or 5 since the fireball must hit exactly K body parts of the dragon. As Jojo can only cast the spell one time, Help Jojo determine the maximum damage output he can deal to the dragon.

In: Computer Science

Please follow the instructions carefully and complete the code given below. Language: Java Instructions from your...

Please follow the instructions carefully and complete the code given below.

Language: Java

Instructions from your teacher:

(This is a version of an interview question I once saw.) In this problem, we will write a program that, given an integer k, an integer n, and a list of integers, outputs the number of pairs in in the list that add to k.

To receive full credit for design, your algorithm must have a runtime in O(n) , where n is the length of the list of integers. Hint: you can assume that the contains in a HashSet is O(1). Your program should take as input a number k on its own line, followed by a number n on its own line, followed by a space-separated list of n integers. It should then output the number of pairs in the list that add to k. Order does not matter when considering a pair (in other words, in the list [2,1] there is one distinct pair that sums to 3, not two). You may assume that all numbers in the input are distinct. For example, if our file input.txt is:

1

6

1 2 3 4 -2 -3

then we should print 2 since there are two pairs that sum to 1: 3 + (-2) and 4 + (-3).

As another example, if input.txt is:

3

4

1 2 3 4

then we should print 1since there is one pair that sums to 1: 1+2.

The problem PairFinder provides starter code for reading and printing; your task is to fill in thefindPairs()method.

.......................................................................................................................

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
  
// Read in the value of k
int k = Integer.parseInt(sc.nextLine());
  
// Read in the value of n
int n = Integer.parseInt(sc.nextLine());
  
// Read in the list of numbers
int[] numbers = new int[n];
String input = sc.nextLine();
if (input.equals("")) {
numbers = new int[0];
} else {
String[] numberStrings = input.split(" ");
for (int i = 0; i < n; i++) {
numbers[i] = Integer.parseInt(numberStrings[i]);
}
}
  
System.out.println(findPairs(numbers, k));
}
  
private static int findPairs(int[] numbers, int k) {
// TODO fill in this function
throw new UnsupportedOperationException();
}
  
}

In: Computer Science

3. Individual and market demand Suppose that Kenji and Lucia are the only consumers of ice...

3. Individual and market demand 

Suppose that Kenji and Lucia are the only consumers of ice cream cones in a particular market. The following table shows their monthly demand schedules: 

Price

(Dollars per cone)

Kenji's Quantity Demanded

(Cones)

Lucia's Quantity Demanded

(Cones)

1612
238
326
414
502


On the following graph, plot Kenji's demand for ice cream cones using the green points (triangle symbol). Next, plot Lucia's demand for ice cream cones using the purple points (diamond symbol). Finally, plot the market demand for ice cream cones using the blue points (circle symbol). Line segments will automatically connect the points. Remember to plot from left to right.

image.png



In: Economics

Issuing Company                    Years to maturity                  

Issuing Company                    Years to maturity                    Yield

1. General Motors                   10 years                                   6.3 percent

2. NC Dept of Education        15 years                                   3.8 percent

3. US Treasury Strip               20 years, 0 coupon                  2.3 percent

4. York County B&T              15 years                                   5.6 percent                       

5. US Treasury                        10 years                                   3.4 percent

6. US Treasury                        20 years, 3.5 coupon               2.6 percent

7. Apple                                  15 years                                   4.1 percent

Briefly explain why these bonds have different interest rates

Do not use the same answer twice.

  1. Bond 1 and Bond 2?
  1. Bond 2 and Bond 6?
  1. Bond 5 and Bond 6?
  1. Bond 3 and Bond 7?
  1. Bond 4 and Bond 7?

In: Finance

(Consumer Choice and Demand) Nachos ($5) pop ($2) Q TU MU MU/$ Quantity Total Utility Marginal...

(Consumer Choice and Demand)

Nachos ($5)

pop ($2)

Q

TU

MU

MU/$

Quantity

Total Utility

Marginal Utility

MU/$

0

0

0

0

-

-

1

90

1

60

2

150

2

100

3

180

3

120

4

195

4

130

5

205

5

136

6

210

6

140

  1. You have a budget of $11, how would you best spend it to maximize your total utility? What is your total utility for this combination? (Fill in the Chart and determine what combination of nachos and pop would give you the highest utility).
  1. If the price of Nachos were to decrease to $3.00 would your utility increase or decrease? Circle the correct answer: Increase or Decrease

In: Economics

Only Question 2 (a, b, c) , but Question 1 is more background information. An experiment...

Only Question 2 (a, b, c) , but Question 1 is more background information.

An experiment focuses on the differences among apple species. Species A was randomly selected out of 4 species in the experiment

1. What if you want to choose Spcies A. ali or Species A. pub. What is the probability that you choose one or the other?

a. P(A. ali or A. pub) =

b. This can be done by adding probabilities. Write an equation if possible.

c. Will these 2 events be mutually exclusive?

2. For the experiment of the 4 apple species, ¼ of the seeds were bought randomly from a friend and then the rest of the seeds were randomly bought from a neighbor.

a.What is the probability that the one you select is either species A. ali or from a neighbor?

b. will the two events be mutually exclusive?

c. What will the general equation be?

In: Statistics and Probability

Computing Straight-Line and Double-Declining-Balance Depreciation On January 2, Haskins Company purchases a laser cutting machine for...

Computing Straight-Line and Double-Declining-Balance Depreciation

On January 2, Haskins Company purchases a laser cutting machine for use in fabrication of a part for one of its key products. The machine cost $120,000, and its estimated useful life is five years, after which the expected salvage value is $7,500. Compute depreciation expense for each year of the machine's useful life under each of the following depreciation methods: Round answers to the nearest whole number, when applicable.

a. Straight-line

Year 1 $Answer

Year 2 $Answer

Year 3 $Answer

Year 4 $Answer

Year 5 $Answer

b. Double-declining-balance

Year 1 $Answer

Year 2 $Answer

Year 3 $Answer

Year 4 $Answer

Year 5 $Answer

In: Accounting

A researcher would like to evaluate the effectiveness of a pain-relief patch designed for lower back...

A researcher would like to evaluate the effectiveness of a pain-relief patch designed for lower back pain. Prior to testing the patch, each of n = 8 patients rates the current level of back pain on a scale from 1 to 10. After wearing the patch for 90 minutes, a second pain rating is recorded. The data are as follows:

                  Before      After

                        6            2

                        8            3

                        9            4

                        8            1

                      10           2

                        5            3

                        9            8

                        7            7

Compute the mean and variance for the sample of difference scores.

Do the results indicate a significant difference?

Use a two-tailed test with α = .05

Compute Cohen’s d to measure the size of the effect.

What is the variance for this study?

Group of answer choices

7

8

4

2

In: Statistics and Probability

python coding Suppose a list of positive numbers is given like the following list (remember this...

python coding

Suppose a list of positive numbers is given like the following list (remember this is only an example and the list could be any list of positive numbers) exampleList: 15 19 10 11 8 7 3 3 1 We would like to know the “prime visibility” of each index of the list. The “prime visibility” of a given index shows how many numbers in the list with indexes lower than the given index are prime. For instance, in the examplList, the “prime visibility” of the index 4 is 2 because there are 2 numbers (19 and 11) before index 4 that are prime. To solve this problem, design and implement a function called primeVisibility with two parameters: 1- The list of numbers 2- The index The function finds and returns the “prime visibility” of the given index.

In: Computer Science

Assume for arithmetic, load/store, and branch instructions, a processor has CPIs of 1, 12, and 5,...

Assume for arithmetic, load/store, and branch instructions, a processor has CPIs of 1, 12, and 5, respectively. Also assume that on a single processor a program requires the execution of 2.56E9 arithmetic instructions, 1.28E9 load/store instructions, and 256 million branch instructions. Assume that each processor has a 2 GHz clock frequency.
Assume that, as the program is parallelized to run over multiple cores, the number of arithmetic and load/store instructions per processor is divided by 0.7 x p (where p is the number of processors) but the number of branch instructions per processor remains the same.

Find the total execution time for this program on 1, 2, 4, and 8 processors, and show the relative speedup of the 2, 4, and 8 processor result relative to the single processor result.

In: Computer Science