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

What are organelles.
How can analogies shape our thoughts? Provide an answer. Need ASAP please
Which of the following processes occurs during sexual reproduction? A. An organism splits in two. B. An egg cell and a sperm cell unite. C. A fragment reg
A line of a slope of 8 passes through the point (-6,4). What is its equation in point slope form?
Why is this so helpful
help me with this please!?!?!?!?!
According to the electron configuration, which atom will be the most reactive? 1s^2 2s^2 1s^2 2s^2 2p^6 3s^2 1s^2 2s^2 2p^6 3s^2 3p^6 1s^2 2s^2 2p^6 3s^2 3p^6 4
Make a model that shows how glucose is rearranged through cellular respiration to form new molecules. Include labels. Identify the number of each type of atom b
The slope is -10 and it passes through (2,5)
When body temperature raises above the set point, __________ will bring the temperature back to the set point.