subject
Engineering, 23.03.2020 20:00 hahHcjckk

C#

1. Given an array with int values in any order, develop codes that will modify the given array so that it will start with negative values, followed by positive values, and then by zeros. Please note that a zero is neither a positive value or a negative value. The order of negatives and the order of positives are not important, but make sure that all the negative values must come before all the positive values and that the zeros must come after everything else. You will need to swap the elements directly in the same array, and do not create a new array. Do not sort the array. Time-complexity: O(n), Space-complexity: O(1).

public void NegativePositiveZero(int[] a)
{

2. The method will MODIFY the original array that is rotated. If rotatedLeft is true, then the array modified will be rotated left by one position. If rotatedLeft is false, then the array modified will be rotated right by one position.

public void Rotate(int[] a, bool rotatedLeft)
{

3. The method will MODIFY the original array, which has been rotated for a number of times (n), by calling the Rotate(int[], bool) method for a number of times (n). The number n can be zero, positive, or negative. That is, if the value of n is zero, the result will remain unchanged. If the value of n is positive, the array will rotate left by n places. If the value of n is negative, the array will rotate right by |n| positions.

public void Rotate(int[] a, int n)
{

4. The method will simply return a new subarray that is in the original array, containing values from the first index to the last index. If your array is { 2, 4, 6, 8, 10, 1, 3, 5, 7} and if the first index is 3 and the last index is 5, the method will return a new array, {8, 10, 1}.

public int[] Subarray(int[] array, int firstIndex, int lastIndex)
{

5. This method will simply create and return a copy of the original array by calling the Subarray method.

public int[] Copyarray(int[] array)
{

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 14:10
When at a point two solid phase changes to one solid phase on cooling then it is known as a) eutectoid point b) eutectic point c) peritectic point d) peritectoid point
Answers: 3
question
Engineering, 04.07.2019 18:20
What is the heat treatment of metals? what is the benefit of it? why and how it's useful? answer in details, do not write by hand.
Answers: 3
question
Engineering, 04.07.2019 19:10
Asteam is contained in a rigid tank with a volume of 1 m3. initially, the pressure and temperature are 7 bar and 500 oc, respectively. the temperature drops due to cooling process. determine: (1) the temperature at which condensation begins in °c, (2) the fraction of the total mass that has condensed when the pressure decreased to 0.5 bar. (3) the volume in m3 occupied by saturated liquid at the final state?
Answers: 3
question
Engineering, 04.07.2019 19:10
What is the major difference between thermoplastics and thermosetting plastics from the polymerization structure point of view?
Answers: 2
You know the right answer?
C#

1. Given an array with int values in any order, develop codes that will modify the gi...
Questions