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, 04.07.2019 08:10
Which of the following is an easy way to remember the modified β€œx” tire rotation? a. nondrive wheels straight, cross the drive wheels b. drive wheels straight, cross the nondrive wheels c. drive wheels crossed, nondrive wheels straight d. drive wheels crossed, nondrive wheels crossed
Answers: 1
question
Engineering, 04.07.2019 18:10
Afull journal bearing has a journal diameter of 27 mm, with a unilateral tolerance of -0.028 mm. the bushing bore has a diameter of 27.028 mm and a unilateral tolerance of 0.04 mm. the l/d ratio is 0.5. the load is 1.3 kn and the journal runs at 1200 rev/min. if the average viscosity is 50 mpa-s, find the minimum film thickness, the power loss, and the side flow for the minimum clearance assembly.
Answers: 1
question
Engineering, 04.07.2019 18:10
Journeyman training is usually related (clo2) a)-to specific tasks b)-to cost analysis of maintenance task c)-to control process to ensure quality d)-to installation of machinery
Answers: 2
question
Engineering, 04.07.2019 18:20
Air flows over a heated plate Γ t a velocity of 50m/s. the local skin factor coefficient at a point on a plate is 0.004. estimate the local heat transfer coefficient at this point.the following property data for air are given: density = 0.88kg/m3 , viscosity 2.286 x 10 ^-5 kgm/s , k = 0.035w/mk ,cp = 1.001kj/kgk. use colburn reynolds analogy.
Answers: 1
You know the right answer?
C#

1. Given an array with int values in any order, develop codes that will modify the gi...
Questions
question
English, 24.03.2020 18:07
question
Mathematics, 24.03.2020 18:07
question
Chemistry, 24.03.2020 18:08
Questions on the website: 13722360