Questions
Using C language, and describe the algorithm design Q2 Problem description n (n is odd) people...

Using C language, and describe the algorithm design

  • Q2 Problem description

n (n is odd) people sitting around a round table playing a game. In this situation, everyone has a left neighbour and a right neighbour. At the beginning, each of them is holding a whiteboard with an integer number. Now, they are playing a game consisting of several rounds. In each round, everyone will first look at the numbers of his/her left neighbour and right neighbour, then calculate the average of the two numbers, replace the number on his/her whiteboard with the average finally. The game terminates when any one has to write a non-integer number on his/her whiteboard.

Given the number of people, the number of passed rounds and the integer numbers on their whiteboards at this moment, you are asked the integer numbers on their whiteboards at the very beginning. The number of rounds increases by 1 when changing the number on the whiteboard and new numbers are all integers.

  • Input & output requirements

Input the number of people n and the number of rounds t on the first line. On the next line are numbers on their whiteboards after t rounds.

Output the integer numbers on their whiteboards at the very beginning.

  • Sample input

3 2

3 1 2

  • Sample output

6 -2 2

In: Computer Science

Earth Company manufactures a single product, Thingy. The standard cost specification sheet shows the following standards...

Earth Company manufactures a single product, Thingy. The standard cost specification sheet shows the following standards for one unit of Thingy.

3 kg of material Y @ $10 per kg

$30

2 hours of direct labour @ $18 per hour

$36

Fixed Overhead - $7 per direct labour hour

$14

Variable Overhead - $4 per direct labour hour

$ 8

The fixed overhead allocation rate is based on normal monthly capacity of 20 000 direct labour hours. Fixed overhead and production are expected to be spread evenly throughout the year.

A total of 6000 Thingy were produced during June. Actual costs incurred during June were:

20,000 kg of material Y were purchased @ $13.50 per kg 22,000 kg of material Y were used.

18,000 direct labour hours were worked at an average wage rate of $15 per hour Actual overhead incurred:

                          Fixed                          $85 000

                          Variable                      $35 000

Required:

  1. Compute the following variances:   (6 marks)

  1. Direct material price variance

  1. Direct material quantity variance

  1. Direct labour rate variance

  1. Direct labour efficiency variance

  1. Variable overhead spending variance

  1. Fixed overhead budget variance

  1. Discuss three factors that could cause an unfavourable direct material quantity variance.

In: Accounting

Categorize a firm you have worked with recently as a defender, prospector, or analyzer. Discuss whether...

Categorize a firm you have worked with recently as a defender, prospector, or analyzer.

Discuss whether or not the staffing systems supported the strategy the firm utilized.

Given the emphasis on teams, cross functional responsibilities and non-traditional forms of jobs, what types of selection systems would you recommend to ensure newcomers have the requisite skills for such firms?

In: Operations Management

Give an example of an Unfair Labour Practice.

Give an example of an Unfair Labour Practice.

In: Operations Management

What are some of the important steps that an organization can follow to ensure a workplace...

What are some of the important steps that an organization can follow to ensure a workplace free from sexual harassment

In: Operations Management

Write a program to ask three options to the user and continue until user selects option...

Write a program to ask three options to the user and continue until user selects option 3.

The first two options prompt a user to enter a string of numbers separated by spaces which is a 2by2 matrix. Do addition and subtraction on the input matrices when user selects 1 and 2.

You must write functions for matrix addition, subtraction and print. You may use the following function str_to_mlist to convert string to a list.

code example is given:

def str_to_mlist(m_str):
"""Converts a string separated by spaces to a list

Parameters
----------
m_str : str, required
Input string separated by spaces
Returns
-------
list
Numbers
"""
    return m_str.split()

A sample run of the code looks like this:

Enter an option
1.Add two matrices
2.Subtract two matrices
3.Quit
1
Enter four numbers separated by spaces and press enter:3 4 -10 3
3 4
-10 3
Enter four numbers separated by spaces and press enter:8 9 0 -2
8 9
0 -2
Your result is:
11 13
-10 1
Enter an option
1.Add two matrices
2.Subtract two matrices
3.Quit
2
Enter four numbers separated by spaces and press enter:1 0 0 1
1 0
0 1
Enter four numbers separated by spaces and press enter:0 -1 -1 0
0 -1
-1 0
Your result is:
1 1
1 1
Enter an option
1.Add two matrices
2.Subtract two matrices
3.Quit
3

In: Computer Science

Determine the running time of each of the algorithms below. For questions 2a. and 2b., you...

Determine the running time of each of the algorithms below. For questions 2a. and 2b., you may determine the running time line-by-line (see Lecture 2, slide No. 8). For questions 2c – 2f, you may determine the running time by focusing on the basic operation of the algorithm.

a,sum = 0; for (i=1; i<=n; i++) sum += n;

b. Algorithm maxVal (numbers, n) currentVal ← numbers [0] for i ← 1 to n − 1 do if numbers [i] > currentVal then currentVal ←A[i] { increment counter i } return currentVal

c. Algorithm prefix1(X, n) //Input array X of n integers //Output array A of prefix averages of X A ← new array of n integers for i ← 0 to n − 1 do s ←X[0] for j ← 1 to i do s ←s + X[j] A[i] ←s / (i + 1) return A

d. Algorithm prefix2(X, n) //Input array X of n integers //Output array A of prefix averages of X A ← new array of n integers s ← 0 for i ← 0 to n − 1 do s ←s + X[i] A[i] ←s / (i + 1) return A

e. Algorithm SumTripleArray(X, n) //Input triple array X[][][] of n by n by n integers //Output sum of elements of X s ← 0 for i ← 0 to n − 1 do for j ← 0 to n − 1 do for k ← 0 to n − 1 do s ←s + X[i][j][k] return s

f. sum = 0; for( i = 0; i < n; i++) for( j = 0; j < n * n; j++) sum++;

In: Computer Science

Product(Facebook Inc.) Remember the brand is wrapped around the product and products can be tangible or...

Product(Facebook Inc.)
Remember the brand is wrapped around the product and products can be tangible or intangible.
a) Describe fully the services provided by Facebook Inc. to consumers (B2C) and businesses (B2B).
Explain why Facebook Inc. product is either tangible or intangible?

For example, for Frito Lays Inc. some of the product types they sell are
potato chips, corn chips, and tortilla chips. For social media companies, there are different types of services.
b) Discuss where you think Facebook Inc. products are in the product life cycle and explain why.
c) Identify the corporate (parent) brand for Facebook Inc. and master brands and include pictures of the logos.   
The parent brand includes the words Company, Corporation, Inc., LLC etc. Sometimes one of the master brands might also include the parent brand name, but without the Inc., Company, Corporation etc. For example, Facebook Inc. and Facebook.
d) Discuss if Facebook Inc. strategy is multi-product branding, multi branding, or private branding and fully explain why based on what you observed and the concepts discussed in the textbook. Include pictures.  
e) Discuss and give examples of Facebook Inc. line extensions or brand extensions. Include pictures.
f) Identify the number of monthly active users and the percent of internet users reached for Facebook Inc.

In: Operations Management

Revisit Shneiderman’s 8 Golden Rules and answer the following questions. Which rules still apply? Which rules...

Revisit Shneiderman’s 8 Golden Rules and answer the following questions.

  1. Which rules still apply?
  2. Which rules apply but require modification?
  3. Do any rules no longer apply?
  4. Do we need new rules for Mobile Apps?

PreviousNext

In: Computer Science

Keep a record of your use of the mass media-television, internet, facebook, gaming, movies, etc.-including your...

Keep a record of your use of the mass media-television, internet, facebook, gaming, movies, etc.-including your reason for using these sources.   Then take the role of a sociologist and write about how you might have been socialized by the media you used. What norms and values were you exposed to? How did they affect you? Which other agents of socialization (besides media) influenced your use of mass media (did peers or other groups/entities entice you?

In: Psychology

In a detailed paragraph please write about the history of covid 19 . Please be as...

In a detailed paragraph please write about the history of covid 19 .

Please be as detailed as possible from how this virus has started and evolved to where it is today.

Thank you

IMPORTANT: If you are going to write please make sure your writing is neat, legible, and easy to read. Please write in print (not cursive). Thank you

In: Nursing

Traversal tree program

Traversal tree program

In: Computer Science

Venn Diagram It is much easier to use Venn Diagrams to proof the DeMorgan's Law. Please...

Venn Diagram

It is much easier to use Venn Diagrams to proof the DeMorgan's Law. Please briefly explain Venn diagrams and Sets.

In: Computer Science

Below is a short list provided by DuPont of common ethical issues in the workplace. Choose...

Below is a short list provided by DuPont of common ethical issues in the workplace. Choose at least three issues and explain what would be a “wrong” expression of that scenario and solve it with a “right” way to solve that scenario.

For example: Mercedes claimed her hair appointment as a company expense. A “wrong” way to handle the situation would be to approve the expense and not confront the employee on the unrelated business expense. A “right” way to solve the issue would be to meet with Mercedes one-on-one to hear her reasoning in qualifying it as an expense. If the expense did not pertain to her work duties, then politely explaining how hair appointments are not considered business-related expenses and she will not be reimbursed for the expense.

Antitrust
Bribes and Kickbacks
Confidential Information
Conflicts of Interest
Expense Reports
Gifts and Entertainment
Harassment
Insider Trading
Misstatement/Falsifying Company Documents
Misuse of Company Assets
Records and Information Management
Responsible Communication
Retaliation and Speaking Up
Sales--Revenue Recognition
Social Media
Third Party Risk
Safety

In: Operations Management

describe the following in detail: a) A Breakout Box b) A Protocol Analyser

describe the following in detail:

a) A Breakout Box

b) A Protocol Analyser

In: Mechanical Engineering