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

There has been a persisting American influence in____and a persisting French influence in____. Group of answer choices Melanesia/Micronesia Melanesia/Polynesia
Write a poem for me please!!
ideas to re-motivate employees
Plz hurry and answer this.
Predict the next number in the sequence: 1, 4, 16, 64… 512 244 384 256
Please solve these two. Emergently, Thank you.
please help! text and question provided.zoom in for the text.​
which countries had fawcett been to before he went to south america and what kind of activities had he done in each of these countries that had helped to prepar
At the movie theatre, child admission is $5.10 and adult admission is $8.80. On Saturday, 157 tickets were sold for a total sales of $1144.80. How many child ti
For purposes of estimating the firm's WACC, what are the weights of long-term debt, preferred stock, and equity given the following information from the balance