1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Tems11 [23]
3 years ago
5

Given an integer n and an array a of length n, your task is to apply the following mutation to an: Array a mutates into a new ar

ray b of length n.
For each i from 0 to n - 1, b[i] = a[i - 1] + a[i] + a[i + 1].
If some element in the sum a[i - 1] + a[i] + a[i + 1] does not exist, it should be set to 0. For example, b[0] should be equal to 0 + a[0] + a[1].
Computers and Technology
1 answer:
Elenna [48]3 years ago
3 0

Answer: provided in the explanation section

Explanation:

import java.util.*;

class Mutation {

public static int[] mutateTheArray(int n , int[] a)

{

int []b = new int[n];

for(int i=0;i<n;i++)

{

b[i]=0;

if(((i-1)>=0)&&((i-1)<n))

b[i]+=a[i-1];

if(((i)>=0)&&((i)<n))

b[i]+=a[i];

if(((i+1)>=0)&&((i+1)<n))

b[i]+=a[i+1];

}

return b;

}

  public static void main (String[] args) {

      Scanner sc = new Scanner(System.in);

      int n= sc.nextInt();

      int []a = new int [n];

     

      for(int i=0;i<n;i++)

      a[i]=sc.nextInt();

     

      int []b = mutateTheArray(n,a);

for(int i=0;i<n;i++)

      System.out.print(b[i]+" ");

     

 

     

  }

}

cheers i hope this helped !!

You might be interested in
_____ is the unauthorized entry into a computer system via any means
Montano1993 [528]
Hi,

The word you are looking for is "Hacking".

"Hacking is unauthorized entry into a computer system via any means."

Hope this helps.
r3t40
4 0
3 years ago
In the broadest of terms, the performance management process features a cycle that begins with ________________ and concludes wi
Flauer [41]

In the broadest of terms, the performance management process features a cycle that starts with Prerequisites and concludes with performance Review.

<h3>What is performance management process?</h3>

Performance management exists as a communication procedure by which managers and employees work together to plan, monitor, and review an employee's work goals and overall contribution to the organization. Effective performance management exists important to businesses. Through both formal and informal processes, it allows them to align their employees, resources, and systems to complete their strategic objectives.

<h3> Steps of the performance process</h3>
  • Step 1: Create a Performance Management Plan. Create the plan as described as possible, avoiding the usage of ambiguous language.
  • Step 2: Set Goals for Performance Management.
  • Step 3: Complete a Performance Review System.
  • Step 4: Create Strong Feedback-Giving Skills.
  • Step 5: Ongoing Employee Performance Management.

Hence, In the broadest of terms, the performance management process features a cycle that starts with Prerequisites and concludes with performance Review.

To learn more about performance management process refer to:

brainly.com/question/14506325

#SPJ4

3 0
1 year ago
How to make a message appear in more than one slack channel
VMariaS [17]

Answer:

On your desktop, hover over the message you'd like to share and click the Share message icon on the right. Use the drop-down menu to choose where you'd like to share the message, and add a note if you'd like. Click Share to see the message expand.

Explanation:

7 0
3 years ago
Which component is most likely to allow physical and virtual machines to communicate with each other?
Diano4ka-milaya [45]

A component which is most likely to allow both physical and virtual machines to communicate with each other is a: virtual switch.

<h3>What is virtualization?</h3>

Virtualization can be defined as the creation of an abstract layer over computer hardware primarily through the use of a software, in order to enable the operating system (OS), storage device, server, etc., to be used by end users over the Internet.

In Cloud computing, some of the components (features) which is not required for a successful virtualization environment include the following:

  • Virtual machine
  • Host machine
  • Hypervisors

In conclusion, we can infer and logically deduce that a component which is most likely to allow both physical and virtual machines to communicate with each other is a virtual switch because it enables the virtual servers and the desktops to communicate.

Read more on virtualization here: brainly.com/question/14229248

#SPJ1

Complete Question:

Which component is most likely to allow physical and virtual machines to communicate with each other?

VHD.

Virtual switch.

Hyper V.

Host OS.

8 0
2 years ago
What should every Software Engineer know about Software Architecture?
Alenkinab [10]
<span>!UML (all of them)
2.Flowchart (more for understanding a real world process of some kind; like a business process)
3.Data model including Bachman (if you don't need to at least understand your data, how it is stored versus a model, i.e., Bachman then you are doing it wrong and your schema could be simplistic)
This is 3 different examples</span>
6 0
3 years ago
Other questions:
  • When you ____ software, you are adapting it from one type of computer or operating system to run on a different computer or oper
    13·1 answer
  • What is the exact number of bits in a memory that contains (a) 128k bits?
    9·1 answer
  • (I'm sorry that this question isn't school related, I can't find answers anywhere else)
    8·1 answer
  • Even though a high-level programming language
    11·1 answer
  • What is meant by polling mode in communication between software andUART and what is its disadvantage as compared to interrupt mo
    14·1 answer
  • An application needs to calculate sales tax for purchases. You decide to simplify the code by putting the sales tax calculation
    9·1 answer
  • When comparing alternative methods for making information systems identification and selection decisions, top management's selec
    7·1 answer
  • (BRAINLIEST QUESTION!!!)
    11·1 answer
  • The engineering firm you work for is submitting a proposal to create an amphitheater at a state park. Proposals must be submitte
    15·1 answer
  • Dante went to change the date for an appointment in his Outlook calendar. He double-clicked in the appointment and made the chan
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!