maljoh7655 maljoh7655
  • 03-01-2020
  • Computers and Technology
contestada

Give pseudocode for an algorithm that removes all negative values from an array, preserving the order of the remaining elements.

Respuesta :

Algorithm
Algorithm Algorithm
  • 05-01-2020

Answer:

Begin.

WRITE  ''enter test array''

READ test array

test [ ] = new_int [ ] { enter test array here, separated by comma}

int [ ] positives = Arrays.stream(test). filter(x -> x >= 0).toArray();

System. out. println( " Positive array");

for (int i : positives) {

      System.out.print(i+ "\t");  }

WRITE  positive array

End

Explanation

The pseudocode for the  alogirithm has been simplified above, it is implemented in Java 8

Answer Link

Otras preguntas

PLEASE HELP !!!!!!!!!!!!
a) A rectangle is 8.7 cm long and 5.4 broad. (i) Find the perimeter of the rectangle. (ii) Find the area of the rectangle. b) A rectangular park is 20.35 m long
20 POINTS! Please help For each question, decide if it is a function. Then find the domain and range in set builder notation.
Where is designing a table for a client the table is a rectangle or shape with a length of 26 inches longer with than it’s with the perimeter of the tables 300
Someone help me pls show work
Can u help me in this???​
Which of the following equations is equivalent to 36 – 2 = 34? 34 + 2 = 36 34 ∙ 2 = 36 34 – 2 = 36 36 + 34 = 2
8x^3+9x^7+5x^3+2+7x^7
where do speech marks go?
Write electrified in a compound sentence