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

Use trig to solve for x show work
Substitution how do u do it??
how does the carbon cycle work in the desert
There is a turtle race. The race will last 2 minutes. I have to find the distance from the start each turtle will be at the end of the race. Speed (in inches pe
What is 38/50 as a decimal... and what is 28/50 as a decimal? PLEASE HELP ME !!!! i hate struggling with homework!
the perimeter of a square is 4 times as great as the length of any of its sides. Determine whether the perimeter of the square is proportional to the side lengt
which is more acidic pH2, pH4 or pH6?
The decline in medieval trade was caused by
What is %15 of $35.15 What is %15 of $27.00
What is %15 of $35.15 What is %15 of $27.00