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

How can I make good budget for healthy foods? How can I be good habit with healthy foods?
The number of aluminum cans used each year varies directly as the number of people using the cans. If 500 people use 120000 cans in one year, how many cans are
Does Brainly.com help with writing composition story’s seven paragraphs long? If not what website does?
convert 8 milliliters to fluid ounces
x > 4 what values of the variable x make the inequality true?
State three factors on which the pressure at a point in a liquid depends.ICSE Class 9 Physics Chapter Pressure in Fluids and Atmospheric Pressure
convert 8 milliliters to fluid ounces
how to simplify tan 11pi/2
An Olympic runner complete the 200 m sprint and 23 seconds. What is the runners average speed (round your answer to the nearest 10th of a meter per second.)
Can u plz help I don’t understand I need an expert